L
lallous
Hello,
Probably I am not seeing it now, but is it possible for constructor(int) to
call constructor() ?
class A
{
private:
int x, y;
public:
A();
A(int);
};
A::A()
{
x = y = 0;
}
A::A(int x)
{
// call A::A() ?
// in Java, it is: this()
}
Or I have to write a small function like:
A::ctor()
{
// do common stuff here
}
A::A()
{
ctor();
}
A::A(int x)
{
ctor();
// more stuff here
}
Probably I am not seeing it now, but is it possible for constructor(int) to
call constructor() ?
class A
{
private:
int x, y;
public:
A();
A(int);
};
A::A()
{
x = y = 0;
}
A::A(int x)
{
// call A::A() ?
// in Java, it is: this()
}
Or I have to write a small function like:
A::ctor()
{
// do common stuff here
}
A::A()
{
ctor();
}
A::A(int x)
{
ctor();
// more stuff here
}