Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

what is abstract class ? when is used in real time ? give a exp

5 Answers  


In which cases you use override and new base?

2 Answers  


What is friend function?

12 Answers   Wipro,


sir i want to know which posting to apply since i am BE CSE.. also want to know what are the rounds there for my interview...Expecting for ur valuable answer....

2 Answers  


In OverLoading concept,Why they are not consider return value and why they are consider only parameters in method? For ex: public int Add(int a,int b){...} public String Add(int a,int b){...}

1 Answers  


Which is faster post increment or pre increment ? and in which cases should u use either - to increase speed?

4 Answers   EA Electronic Arts,


Please tell me the oops concept with detailed answer

9 Answers   EEE,


What are the three parts of a simple empty class?

0 Answers  


What are the benefits of polymorphism?

0 Answers  


char* ptr = "Rahul"; *ptr++; printf("%s",ptr); What will be the output

9 Answers   Persistent,


what is code for call by value and call by reference?

1 Answers  


what is diff between .net 1.1 and .net 2.0

4 Answers  


Categories