Connecting Tech Pros Worldwide Forums | Help | Site Map

a question related to void

liux
Guest
 
Posts: n/a
#1: May 18 '07
I found this sentence in MSDN:
When used as a function return type, the void keyword specifies that the function does not return a value.
Note that "does not return a value".
And I know that Classes have a special member function called a constructor. The constructor can take parameters as needed, but it cannot have a return value.
Here is the question:
Why could not I use void when declare a constructor?

Nindi
Guest
 
Posts: n/a
#2: May 18 '07

re: a question related to void


On May 18, 1:24 pm, "liux" <lyatch...@gmail.comwrote:
Quote:
I found this sentence in MSDN:
When used as a function return type, the void keyword specifies that the function does not return a value.
Note that "does not return a value".
And I know that Classes have a special member function called a constructor. The constructor can take parameters as needed, but it cannot have a return value.
Here is the question:
Why could not I use void when declare a constructor?
I think the compiler already knows its a constructor so void would be
redundant infomation. Also I think actualy behind implicitly the
constructor does return something, a new instant of the object ;



James Kanze
Guest
 
Posts: n/a
#3: May 18 '07

re: a question related to void


On May 18, 2:24 pm, "liux" <lyatch...@gmail.comwrote:
Quote:
Why could not I use void when declare a constructor?
Because the standard says so.

In the end, that's really the only reason. The standard
specifies a very special syntax for constructors, and that's the
syntax you have to use. It could have specified something else,
and then you'd have had to use something else. But any way you
look at it, constructors are not just everyday, run of the mill
functions, and need a special syntax.

--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient閑 objet/
Beratung in objektorientierter Datenverarbeitung
9 place S閙ard, 78210 St.-Cyr-l'蒫ole, France, +33 (0)1 30 23 00 34

liux
Guest
 
Posts: n/a
#4: May 18 '07

re: a question related to void


Thx,I get it.
Maybe my MSDN is too old,it's time to update it.
Default User
Guest
 
Posts: n/a
#5: May 18 '07

re: a question related to void


liux wrote:
Quote:
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN"<HTML><HEAD>

Fix your newsreader (Outlook Express, of course) settings so that it
stops using HTML.




Brian
liux
Guest
 
Posts: n/a
#6: May 19 '07

re: a question related to void


Sorry,what model dose most people send and receive news?
text or html?
"Default User" <defaultuserbr@yahoo.com写入消息新闻:5b6h8uF2rdm6p U1@mid.individual.net...
Quote:
liux wrote:
>
Quote:
><!DOCTYPE HTML PUBLIC
>"-//W3C//DTD HTML 4.0 Transitional//EN"<HTML><HEAD>
>
>
Fix your newsreader (Outlook Express, of course) settings so that it
stops using HTML.
>
>
>
>
Brian

liux
Guest
 
Posts: n/a
#7: May 19 '07

re: a question related to void


Sorry,what model dose most people use when they send and receive news?
text or html?
"Default User" <defaultuserbr@yahoo.com写入消息新闻:5b6h8uF2rdm6p U1@mid.individual.net...
Quote:
liux wrote:
>
Quote:
><!DOCTYPE HTML PUBLIC
>"-//W3C//DTD HTML 4.0 Transitional//EN"<HTML><HEAD>
>
>
Fix your newsreader (Outlook Express, of course) settings so that it
stops using HTML.
>
>
>
>
Brian

Ian Collins
Guest
 
Posts: n/a
#8: May 19 '07

re: a question related to void


liux wrote:
Quote:
Sorry,what model dose most people send and receive news?
text or html?
Please don't top post.

Text.
Quote:
"Default User" <defaultuserbr@yahoo.com写入消息新闻:5b6h8uF2rdm6p U1@mid.individual.net...
Quote:
>liux wrote:
>>
Quote:
>><!DOCTYPE HTML PUBLIC
>>"-//W3C//DTD HTML 4.0 Transitional//EN"<HTML><HEAD>
>>
>Fix your newsreader (Outlook Express, of course) settings so that it
>stops using HTML.
>>

--
Ian Collins.
Joseph Alten
Guest
 
Posts: n/a
#9: May 19 '07

re: a question related to void


liux wrote:
Quote:
Sorry,what model dose most people use when they send and receive news?
text or html?
The standard for usenet is plaintext. Many people's readers cannot
handle the HTML/XHTML some people post, thus turning your post into an
unreadable mess. If you haven't already, turn off your client's HTML
mode (I'm assuming you use Outlook, if not, poke around in your settings):
http://support.microsoft.com/kb/883257

Thanks.
Closed Thread