What is the difference between these defnition of the derived classes constructors:
class Base
{
protected:
int a, b;
public:
Base() {}
Base(int aa, int bb) { a = aa; b = bb; }
};
class Derived : public Base
{
protected:
int c
public:
Derived() {}
Derived(int aa, int bb, int cc) { Base(aa, bb); c = cc; }
// OR
Derived(int aa, int bb, int cc) : Base(aa, bb), c(cc) {}
};
So, what is the difference between Derived(int aa, int bb, int cc) { Base(aa, bb); c = cc; } and Derived(int aa, int bb, int cc) : Base(aa, bb), c(cc) {}? First definition does not work but they look identical.