C++/constructors in c++
Hi sir !why can not we inherit constructors in c++?
i have read so many books.but i can not understand.
can you please explain clearly?
The earlier standard for C++ (C++98) did not allow constructors to be inherited.
"In C++98, we can "lift" a set of overloaded functions from a base class into a derived class ... Little more than a historical accident prevents using this to work for a constructor as well as for an ordinary member function." - Stroustrup
The current C++ standard (C++11) provides the facility to explicitly inherit constructors from a base class.
This must be used with care, though, if a derived class defines new non-static member variables requiring initialization.