#include <iostream>

using namespace std;

class Polygon {
  public:
    float circumference() const { return 0; };
//    float area() const { return 1; };
    virtual float area() const { return 1; };
};

class Rectangle: public Polygon {
  public:
    float circumference() const { return 2; };
  private:
    float area() const { return 3; }
};
      
int main () {
  Polygon p;
  Polygon *pp = new Polygon;     // static Polygon dynamic Polygon
  Polygon *ppr = new Rectangle;  // static Polygon dynamic Rectangle
  Polygon &rp = p;   // static Polygon dynamic Polygon
  Rectangle r;
  Polygon &rpr = r;  // static Polygon dynamic Rectangle
   
  cout << "p:   " << p.circumference() << " : " << p.area() << endl;
  cout << "pp:  " << pp->circumference() << " : " << pp->area() << endl;
  cout << "ppr: " << ppr->circumference() << " : " << ppr->area() << endl;
  cout << "rp:  " << rp.circumference() << " : " << rp.area() << endl;
//  cout << "r:   " << r.circumference() << " : " << r.area() << endl;
  cout << "rpr: " << rpr.circumference() << " : " << rpr.area() << endl;
  
//  cout << "P:   " << ppr->Polygon::circumference() << " : " << ppr->Polygon::area() << endl;
  
  cout << "sizeof(Polygon): " << sizeof(Polygon) << endl;
  
  delete pp, ppr;
  
  return 0;
}
