When i have inheritance, does the compiler-generated functions that i usually get (constructor, destructor, assignment operator and copy constructor) are still generated for my classes?
Let's say i have this inheritance: A base class, B which inherits A (public) and C which public inherits B.
My A class has no memory allocation or anything that requires a destructor to be implemented by me, and i'm not implementing a destructor there, when i compile my program will it still create an empty A::~A(){} ?
Same for B and C.. Thank you!
The rule of 5 still applies to each of the classes, independent of their inheritence.
In other words, if
Bis derived fromA, just becauseAdefined their copy constructor, that doesn't affect the generation ofBs copy constructor.You should, however, be mindful to define a
virtualdestructor for the base class if needed.