Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Define a base class called Shape. The Shape class should have the following members: Protected Member Variable: id (double) A constructor with parameter a. It

image text in transcribed
Define a base class called Shape. The Shape class should have the following members: Protected Member Variable: id (double) A constructor with parameter a. It should set the value of member id with a. Public virtual function: print. This function will print "Polymorphism". b) Define a class named Circle. It should be derived from the Shape class and have following members: A constructor with parameter c. It should call the base class constructor to set the value of member id with c. A print function that overrides the print function in the base class. This function should call base class's print function and also print the data member id. c) After you have created these classes, create a test program (containing main()) that does the following defines a Circle object with id 10. declares a Shape pointer. The Shape pointer will point to object of class Circle. uses the Shape pointer to invoke print function. d) State the output of the program

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

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions

Question

2. When is the job to be completed?

Answered: 1 week ago

Question

why are some people classified as being underemployed

Answered: 1 week ago

Question

=+Do you want to work from home?

Answered: 1 week ago

Question

=+ What skills and competencies will enable someone

Answered: 1 week ago

Question

=+to live and work wherever he or she wants?

Answered: 1 week ago