A
Asfand Yar Qazi
Hi,
Consider this:
class C
{
int j;
public:
C(int i)
: j(i)
{
}
C()
{
//C::C(0)
// this is obviously wrong, but is
// something like this possible?
*this = C(0);
}
}; // class C
Is there any way of calling another constructor from a
constructor to initialize your object? I know about using the
assignment operator as a go-between as above, but is there some
other more efficient way?
Thanks,
Asfand Yar
Consider this:
class C
{
int j;
public:
C(int i)
: j(i)
{
}
C()
{
//C::C(0)
// this is obviously wrong, but is
// something like this possible?
*this = C(0);
}
}; // class C
Is there any way of calling another constructor from a
constructor to initialize your object? I know about using the
assignment operator as a go-between as above, but is there some
other more efficient way?
Thanks,
Asfand Yar