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
Post a Comment