What exactly is the difference between these two: both are ints int x;
x(0)
and
int x = 0
Are they equivalent and if not why?
EDIT:
It's to deal with inheritance. You've got something looking like this:
class A{
protected:
int x;
public:
A() : x(0) {};
void show {cout << "x" << x; }
};
Class B {
protected:
int y;
public:
B() {x = 0; y = 2; }
void show {cout << "x" << x << "y" << y; }
};
Is the x(0)
legal? Please clarify.