ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
   
 
Categories  >>  Software  >>  Programming Languages  >>  C++  >>  OOPS
 
 


 

 
 STL interview questions  STL Interview Questions
 OOPS interview questions  OOPS Interview Questions
 C++ General interview questions  C++ General Interview Questions
Question
Write an operator overloading program to Overload ‘>’
operator so as to find   greater among two instances of the
class.
 Question Submitted By :: Hash
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Write an operator overloading program to Overload ‘>’ operator so as to find greater among two instances of the class.
Answer
# 1
# 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
Niraj Verma
 

 
 
 
Other OOPS Interview Questions
 
  Question Asked @ Answers
 
What is the difference between declaration and definition?  19
What is Object and Class? What are the differences between them?  5
Have you ever interfaced with a database? IBM2
When will a constructor executed? TCS5
How is data security provided in Object Oriented languages? ?  5
which structured data type is not used in c++? 1.union 2.structure 3.string 4.boolean HCL2
Can we create object of class with private constructor?  5
what is namespace? what are the uses of namespace?  1
what is virtual destructor TCS7
what is an qt4 interface? IBM1
why constructor cannt be declar virtually? why destructor cannt be overloaded? Infosys2
char* ptr = "Rahul"; *ptr++; printf("%s",ptr); What will be the output Persistent9
 
For more OOPS Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2012  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com