Please remember our 05-04 Lab Exercise 3: Write class shape with width and height
How to use Abstract class to solve the problem?
Write class shape with width and height following a constructor that gives value to them.
Then define two sub-classes triangle and rectangle.
Those sub-classes can calculate the area of the shape area().
Remember, Rectangle area = (width * height)
Triangle area = (width * height)/2
#include <iostream>
using namespace std;
// Base class
class Shape 
{
public:
   // Your code: pure virtual function providing interface framework.
   // constructor and setWidth(int w) and setHeight(int h) functions here
protected:
   int width;
   int height;
};
// Derived classes
class Rectangle: public Shape
{
public:
   // Your code:    int getArea()
};
class Triangle: public Shape
{
public:
   // Your code:    int getArea()
};
int main(void)
{
   Rectangle Rect;
   Triangle  Tri;
   int w,h;
   cin >>w>>h;
   Rect.setWidth(w);
   Rect.setHeight(h);
   cin >>w>>h;
   Tri.setWidth(w);
   Tri.setHeight(h);
   cout << Rect.getArea() << ";" << Tri.getArea() << endl; 
   return 0;
}