Derive the cube class from the base square class


Discuss the below:

Q: Derive the cube class from the base square class. Assume the square class has a protected member variable representing the side called side and declared as a double with a default value of 1.0. It also has a public function called calcVal that evaluates the area of a square as side * side.

In your derived class have the default values for side be 1. For the cube class include a public function calcVal that evaluates the volume of the cube. (Hint: The volume of the cube is side * square :: calcVal.)

 

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Derive the cube class from the base square class
Reference No:- TGS01936637

Now Priced at $20 (50% Discount)

Recommended (95%)

Rated (4.7/5)