#include<iostream> using namespace std; class CRectangle { int *latime,*lungime; public: CRectangle(int,int); ~CRectangle(); int

aria(void) { return(*latime * *lungime); } }; CRectangle::CRectangle(int a, int b)//constructor { latime=new int; lungime=new int; *latime=a; *lungime=b; } CRectangle::~CRectangle()//desctructor { delete latime; delete lungime; } int main() { CRectangle rect(3,4),rectb(5,6); cout<<"rect aria: "<<rect.aria()<<endl; cout<<"rectb aria:"<<rectb.aria()<<endl; getchar(); return 0; }

Sign up to vote on this title
UsefulNot useful