Inheritance in C++; Is class data inherited as well? -


so if there function greet in parent class base , virtual.

there's property named name in parent class.

now class named child inherits , greet not implemented property name has changed in child class. when calling child.greet() uses child's name or parent's name?

explanation on reason of design decision appreciated.

it uses value of name @ point of calling. if child sets name before call greet uses value set child. if child sets name after call greet uses default value or whatever has been set before call.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -