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 |
What is the benefit of oop?
What is polymorphism what is it for and how is it used?
Which is not an object oriented programming language?
What is inheritance write a program to show use of inheritance?
What are the features of oop?
What is persistence in oop?
What is advantage of inheritance?
why the argument is passed by reference to a copy constructor?example?
Which is faster post increment or pre increment ? and in which cases should u use either - to increase speed?
What is virtual constructors/destructors?
all about pointers
What is property in oops?