×

Loading...

what's wrong with this code?

class Base {
public:
Base(int initialValue = 0): x(initialValue) {}

private:
int x;
};

class Derived: public Base {
public:
Derived(int initialValue)
: Base(initialValue), y(initialValue) {}

Derived& operator=(const Derived& rhs);

private:
int y;
};

Derived& Derived::operator=(const Derived& rhs)
{
if (this == &rhs) return *this;
y = rhs.y;
return *this;
}
Report

Replies, comments and Discussions: