Question: C++ Problem 3: Inheritance. Make sure you understand the meaning of private, public, protected in all possible situations Write the C++ code as instruction below
C++


Problem 3: Inheritance. Make sure you understand the meaning of private, public, protected in all possible situations Write the C++ code as instruction below Shape (Base class): has two attributes (double width, double height). Define the necessary accessor and mutator functions, overloaded constructor, default constructor for the base class. (No need to spilt declaration and implementation) Triangle (Child class): inherits from the base class. Define overloaded constructor, default constructor, and getArea) for the child class. Assume area of triangle is Area-(width * height)/ 2. (No need to spilt declaration and implementation) - Please practice it seriously. Follow the instruction, don't do any unnecessary that you have NOT been asked for (in this review and also in the exam)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
