I have
how the Base copy constructor will be executed?Code:class Base { int a; public: Base(); Base(int); Base(const Base& b); //copy constructor }; Base::Base(const Base& b){ a=b.a;} class Derived public: Base{ int x; public: Derived(); Derived(int); Derived(const Derived& d); //copy constructor }; Derived::Derived(const Derived& d) :Base(d){ //<--MY QUESTION HERE. x=d.x; }
d is a reference to Derived class. It is not a reference to a Base class.
Any help will be appreciated.