Write an operator overloading program to Overload ‘>’
operator so as to find greater among two instances of the
class.
Answer / niraj verma
# include<iosteam.h>
# include<conio.h>
Class Greatest
{
Private:
Int x;
Public:
Void getdata
{
Cout<<” Enter any number”
Cin>>x;
}
Void operator > (greatest obj2)
{
If (x > obj2.x)
{
Cout<<”\n Greatest =”<<obj2.x;
}
Else
{
Cout<<”\n Greatest =”<<x;
}
}
};
Void main ( )
{
Greatest obj1, obj2;
Obj1. getdata ( );
Obj2. getdata ( );
Obj > obj2;
Getch ( );
}
| Is This Answer Correct ? | 4 Yes | 3 No |
Base class has two public data members. How can i derive a new class with one datamember as public and another data member as private?.
Write a program to get the binary tree.
What are different types of JVM's? for example we use dalvik jvm for android then what about the remaining operating systems?
tel me oops defination in single line
Program to open a file with First argument
What is Virtual Keyword?
Which is the best institute in hyderabad for C/C++ and it also has fast track course structure.
What are benefits of oop?
What does and I oop mean in text?
What is difference between function overloading and overriding?
how do you handle yourself when you feel the wald is aganist you
What is difference between data abstraction and encapsulation?