Saturday 23 June 2012

What accessor is actual in child class if child class changes accessor for virtual function from public (in base class) to private (in inherited class)?

Accessor will be like one in base class (public).

Whenever you declare your function as "virtual", you instruct the compiler to generate a virtual call, instead of the direct call to this function. Whenever you override the virtual function in the descendant class, you specify the behavior of this function (you do not change the access mode for those clients, who rely on the "parent's" interface).

No comments:

Post a Comment