473,386 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

a question related to void

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?
May 18 '07 #1
8 1212
On May 18, 1:24 pm, "liux" <lyatch...@gmail.comwrote:
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 ;

May 18 '07 #2
On May 18, 2:24 pm, "liux" <lyatch...@gmail.comwrote:
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:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

May 18 '07 #3
Thx,I get it.
Maybe my MSDN is too old,it's time to update it.
May 18 '07 #4
liux wrote:
<!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
May 18 '07 #5
Sorry,what model dose most people send and receive news?
text or html?
"Default User" <de***********@yahoo.comдÈëÏûÏ¢ÐÂÎÅ:5b*********** **@mid.individual.net...
liux wrote:
><!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

May 19 '07 #6
Sorry,what model dose most people use when they send and receive news?
text or html?
"Default User" <de***********@yahoo.comдÈëÏûÏ¢ÐÂÎÅ:5b*********** **@mid.individual.net...
liux wrote:
><!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

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

Text.
"Default User" <de***********@yahoo.comдÈëÏûÏ¢ÐÂÎÅ:5b*********** **@mid.individual.net...
>liux wrote:
>><!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.
May 19 '07 #8
liux wrote:
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.
May 19 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: bonj | last post by:
Hello How do I declare a template class such that the template class T must implement a certain interface? e.g. interface IProvideID { int MyID; };
10
by: david wolf | last post by:
The following pthread code cannot compile, I want to know why. Can somebody give me direction on this? if I replace the following line of code status1 = pthread_create(&threadID1, NULL, read,...
6
by: Bill Rubin | last post by:
The following code snippet shows that VC++ 7.1 correctly compiles a static member function invocation from an Unrelated class, since this static member function is public. I expected to compile the...
3
by: michael_geller | last post by:
While experimenting with binding datasets to an MS DataGridView, I get a warning that tells me that my DataRows are "either undeclared or was never assigned". Assuming that I am reading the...
3
by: sam_cit | last post by:
Hi, Everybody, i have a situation where i receive data in a buffer and i read the buffer and store it in a linked list, one the problem is i can receive any number of data... so i might run out...
4
by: velvetyuan | last post by:
I'm not sure whether it is proper to post it here, but I regard it at least has something to do with C++. Let me try to clarify my problem: I have two files: triangle.h, triagle.c I compiled...
2
by: Philipp Reh | last post by:
Dear group, I recently tried to port some of my code to a VC++8.0 environment. I noticed that some boost::enable_if related code fails to compile there which works under gcc. I've made a...
14
by: Gray Alien | last post by:
I have two related structs: struct A { int x ; void * data ; }; and
1
by: MaryamSh | last post by:
Hi, I am creating a Dynamic Search in my application. I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove) By pressing Add button...
0
by: MaryamSh | last post by:
Create Dynamic Dropdownlist Controls and related event -------------------------------------------------------------------------------- Hi, I am creating a Dynamic Search in my application. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.