Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ Reinforce and practice the concepts of Polymorphism and Inheritance. Create a base class called Figure that has the following characteristics: - Has two

In C++
image text in transcribed
image text in transcribed
Reinforce and practice the concepts of Polymorphism and Inheritance. Create a base class called Figure that has the following characteristics: - Has two elements (length and height) with access method protected (no private) OR - a get function that receives length and height and assigns them to their corresponding variables. - It is not a getter since they return each value separately, This method - It has an area method (of type float) that does not receive input arguments and that is declared using polymorphism. - For the base class in this example you can simply return 0. Create a class called Rectangle and derive it from the base class. You must have the - A public method called area that returns the area of the rectangle. Create a class called Triangle and derive it from the base class. You must have the - A public method called area that returns the area of the triangle. Create two pointer objects of the figure class (Rectangle and triangle) and for each of them create a new object of each of the derived classes

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

PostgreSQL 10 High Performance Expert Techniques For Query Optimization High Availability And Efficient Database Maintenance

Authors: Ibrar Ahmed ,Gregory Smith ,Enrico Pirozzi

3rd Edition

1788474481, 978-1788474481

More Books

Students also viewed these Databases questions

Question

6. Identify seven types of hidden histories.

Answered: 1 week ago

Question

What is the relationship between humans and nature?

Answered: 1 week ago