Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- class myclass
- {
- public:
- static int x;
- int y;
- void setx(int n)
- {x = n; }
- void sety(int n)
- {y = n; }
- int getx()
- {return x; }
- int gety()
- {return y; }
- };
- int myclass:: x;
- int main()
- {
- myclass o1, o2;
- myclass:: x = 7;
- o1.sety(16);
- o2.sety(14);
- cout<< o1.getx() << o1.gety()<<endl;;
- cout<< o2.getx() << o2.gety();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement