Write base class with the name Shape . The Shape class have Private Variable: area, a double used to hold the shape's area. Public Member Functions: getArea the Accessor. This function should return the value in the member variable area. Parameterized constructor—Initializes area member. Defualt constructor— Empty body calcArea. This function should be a  incomplete function.Next, define a class named Triangle . It should be child of Shape class. It should have the following members:Protected Member Variables: base, a  integer used to hold the base of triangle.Height, a integer used to hold the height of the triangle. Public Member Functions: constructor—Initializes values for base, height. The overridden calcArea function in Circle described below.calcArea—calculates the area of the Triangle (1/2* base * height) and stores the result in the inherited member area.After you have created these classes, create a driver program that defines a Triangle object. Demonstrate that each object properly calculates and reports its area. Use Proper Exception handling in this program.What type of inheritance is used in this given scenario(Single , Multiple or Multilevel). Is calcArea must be overrided ?  write in c#

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 1PE: In Chapter 10, the class clockType was designed to implement the time of day in a program. Certain...
icon
Related questions
Question

Write base class with the name Shape . The Shape class have Private Variable: area, a double used to hold the shape's area. Public Member Functions: getArea the Accessor. This function should return the value in the member variable area. Parameterized constructor—Initializes area member. Defualt constructor— Empty body calcArea. This function should be a  incomplete function.Next, define a class named Triangle . It should be child of Shape class. It should have the following members:Protected Member Variables: base, a  integer used to hold the base of triangle.Height, a integer used to hold the height of the triangle. Public Member Functions: constructor—Initializes values for base, height. The overridden calcArea function in Circle described below.calcArea—calculates the area of the Triangle (1/2* base * height) and stores the result in the inherited member area.After you have created these classes, create a driver program that defines a Triangle object. Demonstrate that each object properly calculates and reports its area. Use Proper Exception handling in this program.What type of inheritance is used in this given scenario(Single , Multiple or Multilevel). Is calcArea must be overrided ? 

write in c#

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning