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 |
How do you use inheritance in unity?
What do you mean by multiple inheritance and multilevel inheritance? Differentiate between them.
write a program in c++ to overload the function add (s1,s2) where s1 and s2 are integers and floating point values.
What is a class in oop?
What does no cap mean?
Why is oop useful?
why overriding?
What is object and class in oops?
When not to use object oriented programming?
Pls...could any one tell me that whether we can access the public data memeber of a class from another class with in the same program. Awaiting for your response Thanku
why the argument is passed by reference to a copy constructor?example?
What is difference between inheritance and polymorphism?