#include <iostream.h>
#include <conio.h>
//******Class Definition********
class Minus
{
private:
int a, b, c ;
public:
//**********Member Functions ***************
Minus() {} // Default Constructor
Minus(int A, int B, int C)
{a=A; b=B; c=C;}
void display(void)
{
cout << "\t a = " << a<< endl ;
cout << "\t b = " << b << endl ;
cout << "\t c = "<< c << endl ;
}
//********Operator Function Definition *******
Minus operator - (void) // Declarative with the return type Minus
{
Minus temp;
temp.a = -a ;
temp.b = -b ;
temp.c = -c ;
return temp;
}
} ; // End of the class definition
//*******Main Functiion************
void main(void)
{
clrscr();
Minus M1(5, 10, -15); // Initialization of the object M1 of type Minus
cout<< "\n Before activating the operator -( ):\n";
M1.display( ) ;
Minus M2 ; // Definining the object M2 of type Minus
M2 = -M1 ; // Activates the function operator -( ) and
// assigns the value of -M1 to M2
cout<< "\n After activating the operator -( ):\n" ;
M2.display( ) ;
getch();
}