Subject: Constructor With a Default?
Posted By: n6532l Post Date: 9/17/2003 3:51:24 PM

If I have a constructor with a default defined as:

CCandyBox(char* str = "Candy")
{
...
}

And I define an object without an argument list "CCandyBox myCandyBox;" does this constructor get called?

Reply By: Ankur_Verma Reply Date: 9/18/2003 5:13:48 AM
It does get called in this case if that is all you
wanna know.
Reply By: nikolai Reply Date: 9/18/2003 2:16:14 PM
Technically, yes... but you'll get compiler errors if you have a default constructor defined (one that takes no parameters), or any other constructors whose parameters have default values.


Take care,

Nik
http://www.bigaction.org/

Go to topic 4270

Return to index page 1043
Return to index page 1042
Return to index page 1041
Return to index page 1040
Return to index page 1039
Return to index page 1038
Return to index page 1037
Return to index page 1036
Return to index page 1035
Return to index page 1034