Write a full program for a class named Polygon with two public data members' width and height. Create two classes Rectan
Posted: Thu Jul 14, 2022 2:12 pm
Write a full program for a class named Polygon with two public data members' width and height. Create two classes Rectangle and Triangle derived from Polygon class and use the public data members (in the base class) in the method called area () to calculate areas of rectangle and triangle in the derived classes. Formula area of triangle: 1/2∗ base*height Formula area of rectangle: width * height