V
vkp
Hi All,
Need little education on use of Virtual functions....the questions
arose from the existing code I am going through.
Class type -> Derived, Member funtion -> Not virtual, Calls Derived
first then base.
Class type -> Derived, Member funtion -> Virtual, Calls Derived first
then base.
Class type -> Base, Member funtion -> Not Virtual, Calls Base.
Class type -> Base, Member funtion -> Virtual, Calls Derived first
then base.
What happens if both Base class and derived class declare a function
virtual. Who gets the first call? Is it valid to delclare a function
Virtual in both classes? If valid, is it a good design? Is there a
situation that requires such declarations?
Thanks in advance !
-vkp.
Need little education on use of Virtual functions....the questions
arose from the existing code I am going through.
Class type -> Derived, Member funtion -> Not virtual, Calls Derived
first then base.
Class type -> Derived, Member funtion -> Virtual, Calls Derived first
then base.
Class type -> Base, Member funtion -> Not Virtual, Calls Base.
Class type -> Base, Member funtion -> Virtual, Calls Derived first
then base.
What happens if both Base class and derived class declare a function
virtual. Who gets the first call? Is it valid to delclare a function
Virtual in both classes? If valid, is it a good design? Is there a
situation that requires such declarations?
Thanks in advance !
-vkp.