Write an operator overloading program to Overload ‘>’
operator so as to find greater among two instances of the
class.



Write an operator overloading program to Overload ‘>’ operator so as to find greater among..

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

Post New Answer

More OOPS Interview Questions

Is abstract thinking intelligence?

0 Answers  


when my application exe is running nad i don't want to create another exe what should i do

2 Answers   HCL,


What is oops and its features?

0 Answers  


1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321

2 Answers  


What is the difference between procedural programming and oops?

0 Answers  






You have one base class virtual function how will call that function from derived class?

4 Answers  


what is the new version of oops

0 Answers   Ignou,


State what is encapsulation and friend function?

0 Answers   BirlaSoft,


create a c++ program that will ask 10 numbers and display their sum using array.

1 Answers  


Write a program to sort the number with different sorts in one program ??

0 Answers   NIIT,


what is difference between String s=new String("vali"); String s="vali"

1 Answers  


is java purely oop Language?

49 Answers   HCL, Infosys, TCS,


Categories