Page 1 of 1

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:10 pm
by answerhappygod
Write A Full Program For A Class Named Polygon With Two Public Data Members Width And Height Create Two Classes Rectan 1
Write A Full Program For A Class Named Polygon With Two Public Data Members Width And Height Create Two Classes Rectan 1 (18.94 KiB) Viewed 29 times
Hi. Full program with the output. Thank you in advance.
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