Question: C++ Bob defines a base class, Base, with instance method func (), but does not declare it to be virtual Alicia (who has no access

C++  C++ Bob defines a base class, Base, with instance method func

Bob defines a base class, Base, with instance method func (), but does not declare it to be virtual Alicia (who has no access to Bob's source code) defines three derived classes, Derl, 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 (). She is also aware that they 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. A. Ying can call p rightarrow func () on each object in the loop and get distinct behavior as defined by the object pointed to. B. Ying can call P rightarrow func () on each get in the loop (no correction) and will always get the base behavior of function. C. Ying can call P rightarrow func () on each object in the loop and get no compiler error. D. Since Ying's loop pointer, P, is type Base, no compiler error will occur. E. Ying can call rightarrow func () on each object in the loop and get distinct behavior as defined by the object pointed to if she uses type correction to assist her

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!