Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- #include<stdio.h>
- #include<conio.h>
- #include<iostream.h>
- class demo
- {
- long int n1,n2;
- public:
- demo(long int x)
- {
- n1=x;
- }
- demo(demo &a1,demo &a2)
- {
- cout<<"\n======================================";
- if(a1.n1==a2.n1)
- {
- cout<<"\n BOTH numbers are SAME";
- }
- else
- {
- if(a1.n1>a2.n1)
- {
- cout<<"\nBig number is ==> "<<a1.n1;
- }
- else
- {
- cout<<"\nBig number is ==> "<<a2.n1;
- }
- }
- }
- void dis()
- {
- cout<<"\n ===============";
- cout<<"\n n1 ==> "<<n1 ;
- }
- };
- int main()
- {
- long int a,b;
- clrscr();
- cout<< "\nobj a1: Enter number 1 => ";
- cin>>a;
- cout<< "\n\nobj a2: Enter number 1 => ";
- cin>>b;
- //call of obj a1
- demo a1(a);
- //call of obj a2
- demo a2(b);
- cout<<"\na1 object's output";
- //call of display obj a1
- a1.dis();
- cout<<"\n\na2 object's output";
- //call of display obj a2
- a2.dis();
- //call of obj a3
- demo a3(a1,a2);
- getch();
- return 0;
- }
Add Comment
Please, Sign In to add comment