Question: In c++ Bob defines a base class, Base, with instance method func, and declares it to be virtual. Alicia (who has no access to Bob's
In c++



Bob defines a base class, Base, with instance method func, and declares it to be virtual. Alicia (who has no access to Bob's source code) defines three derived classes, Der1, Der2 and Der3, of the base class and overrides func () Ying has no access to Bob or Alicia's source code and does not know anything about the derived classes, including their names or how many derived classes exist. Ying does know about the Base class and knows about its public instance function func ). She is also aware that there may be derived classes that override func () Ying uses a Base pointer, p, to loop through a list of Base object pointers. Ying is aware that the list pointers may point to Base objects or some subclass objects of Base Check all that apply Ying can call p->func) on each object in the loop and get distinct behavior as defined by the object pointed Since Ying's loop pointer, p, is type Base, no compiler error will occur Ying can call p->func) on each object in the loop and force only base class behavior of that method by using type coercion Ying can call p->func) on each object in the loop (no coercion) and will always get the Base behavior of this function
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
