Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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++

image text in transcribed

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions

Question

=+ What is their expected negotiating style?

Answered: 1 week ago

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago