#include<iostream>
using namespace std;
class rect
{
public:
int len,wid;
rect(int l,int w)
{
len=l;
wid=w;
}
int area()
{
return len*wid;
}
};
void main()
{
rect r1(10,5),*p;
p=&r1;
cout<<(*p).len<<endl;
cout<<p->wid<<endl;
cout<<p->area()<<endl;
}
#include<iostream>
using namespace std;
class rect
{
public:
rect(int l=10,int w=5);
int area();
private:
int len;
int wid;
};
rect::rect(int l,int w)
{
len=l;
wid=w;
}
int rect::area()
{
return len*wid;
}
void main()
{
rect r1;
cout<<r1.area()<<endl;
}