Not. this does not hold for members of a child class. This way, members of the Derived class will simply be sliced. This problem is called Object Slicing .
How to solve it?
Prevention is better than cure!
Do not enter code in a situation in which Object Slicing .
If you encounter an Object Slicing problem, you have a poorly designed / developed program. Unless, of course, you sacrifice a good OOP design in favor of expediency.
source share