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 |
In multilevel inheritance constructors will be executed from the .... class to ... class
Program to check whether a word starts with a capital letter or not.
what is the difference between <stdio.h>and "stdio.h"?
What is the diamond problem in inheritance?
What is the difference between the c++ & java?
#include <iostream> using namespace std; struct wow { int x; }; int main() { wow a; wow *b; a.x = 22; b = &a; a.x = 23; cout << b->x; return 0; }
1. Define a class.
What are virtual functions?
i have to create a view in SQL as like in ORACLE DATA EXPRESS EDITION
What are the features of oop?
what is the basic concept of inheritance?
What is destructor example?