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 |
Is abstract thinking intelligence?
when my application exe is running nad i don't want to create another exe what should i do
What is oops and its features?
1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321
What is the difference between procedural programming and oops?
You have one base class virtual function how will call that function from derived class?
what is the new version of oops
State what is encapsulation and friend function?
create a c++ program that will ask 10 numbers and display their sum using array.
Write a program to sort the number with different sorts in one program ??
what is difference between String s=new String("vali"); String s="vali"
is java purely oop Language?
49 Answers HCL, Infosys, TCS,