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
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
Comment