Untitled

mail@pastecode.io avatar
unknown
plain_text
16 days ago
586 B
0
Indexable
Never
#include<iostream>
using namespace std;
class rectangle
{

private:
    int length, breadth;
    static int count;

public:
    void setdata(int l, int b)
{

    length= l, breadth=b, count++;

}
void displaycount()
{

    cout<<count<<endl;

}

};

int rectangle:: count;

int main()
 {
    rectangle r1, r2, r3;
    r1.displaycount();
    r2.displaycount();
    r3.displaycount();

    r1.setdata(15,6);
    r2.setdata(9,8);
    r3.setdata(12,9);

    r1.displaycount();
    r2.displaycount();
    r3.displaycount();
    return 0;


}

Leave a Comment