s has a subclass encapsulating a parallelepiped, or box. A parallelepiped has a rectangle as its base, and another attribute named depth. The derived class Box should have a constructor, a volume() function and an override function n
2-) Write a superclass encapsulating a rectangle. A rectangle has two attributes representing the width and the height of the rectangle as a data members. It has methods returning the perimeter(P=2*(L+W)) and the area of the rectangle(A=L*W). This class has a subclass encapsulating a parallelepiped, or box. A parallelepiped has a rectangle as its base, and another attribute named depth. The derived class Box should have a constructor, a volume() function and an override function named area () that returns the surface area of the box. Include the classes constructed in a working C++
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images