L
lallous
S³awek said:Can one constructor of an object call another constructor of the same class?
class foo
{
foo(float f, int i) // a "full" constructor
{
...
}
foo(int i) // a "simplified" constructor
{
?? a call to foo(float,int), BTW this->foo(x,i) doesn't work ??
}
}
Obviously it's possible to use a base class with the "full" constructor or
write private function (foo_init(float,int) called via foo(float,int) and
foo(int i) ). Nevertheless I look for an alternative solution - with a
similar architecture to the class foo. Is it possible to call a constructor
like a function?
TIA
Slawek
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&threadm
=burbmc%24lipge%241%40ID-161723.news.uni-berlin.de&rnum=1&prev=/groups%3Fq%3
Dlallous%2Bctor%26sourceid%3Dopera%26num%3D0%26ie%3Dutf-8%26oe%3Dutf-8
Also:
"[10.3] Can one constructor of a class call another constructor of the
same class to initialize the this object?"
You can get the FAQ at:
http://www.parashift.com/c++-faq-lite/