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