Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- class X
- {
- private:
- int x;
- public:
- class Y
- {
- int y;
- public:
- Y()
- {
- y=0;
- }
- void in()
- {
- cout<<"Enter Value Of Y =";
- cin>>y;
- }
- int show()
- {
- return y;
- }
- }ob1;
- class Z
- {
- int z;
- public:
- Z()
- {
- z=0;
- }
- void in()
- {
- cout<<"Enter Value Of Z =";
- cin>>z;
- }
- int show()
- {
- return z;
- }
- }ob2;
- void get()
- {
- ob1.in();
- ob2.in();
- }
- void add()
- {
- x=ob1.show()+ob2.show();
- }
- void out()
- {
- cout<<"X = "<<x;
- }
- };
- int main()
- {
- X ob;
- ob.get();
- ob.add();
- ob.out();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement