#include <iostream.h>
#include<conio.h>
class CRectangle
{
private:
int width, height;
public:
CRectangle (int,int); //Parameterized Constructor
int area ()
{
return (width*height);
}
~CRectangle()
{};
};
CRectangle::CRectangle (int a, int b)
{
width = a;
height = b;
}
void main ()
{
CRectangle rect (3,4);
cout << "rect area: " << rect.area() << endl;
getche();
}
No comments:
Post a Comment