/*
Like any other function, a constructor can also be overloaded with more than one
function that have the same name but different types or number of parameters. 
Remember that for overloaded functions the compiler will call the one whose 
parameters match the arguments used in the function call. In the case of constructors, 
which are automatically called when an object is created, the one executed is the one 
that matches the arguments passed on the object declaration:
*/

#include <iostream>
using namespace std;

class CRectangle 
{
      int width, height;
      public:
             CRectangle ();
             CRectangle (int,int);
             
             int area() 
             {
                 return (width*height);
             }
};

CRectangle::CRectangle () 
{
          width  = 0;
          height = 0;
}

CRectangle::CRectangle (int a, int b)
{
          width  = a;
          height = b;
}

int main () 
{
    CRectangle rect1(3,4);
    CRectangle rect2;
        
    cout << "Area of rect1: " << rect1.area() << endl;
    cout << "Area of rect2: " << rect2.area() << endl;
    
    std::cin.get();
    return (0); 
} 
    
