#include <iostream.h>
#include <conio.h>
class Minus
{
private:
int a, b, c;
public:
Minus( ) {} // Default Constructor
Minus(int A, int S, int C)
{
a = A;
b = S;
c = C;
}
void display(void);
//********Declaration of the operator function**********
void operator - ( );
}; // End of the Class Definition
//***********Member Function Definitions*************
inline void Minus:: display(void)
{
cout<<"\t a="<< a <<endl;
cout<<"\t b=" << b <<endl;
cout<<"\t c = "<< c<< endl;
}
//*********Definition of the operator function***********
inline void Minus :: operator - ()
{
a = -a;
b = -b;
c = -c;
//*************Main Function Definition**************
}
void main(void)
{
clrscr();
Minus M(5, 10, -15);
cout <<"\nBefore Activating the Operator - ( )\n";
M.display( );
-M;
cout<< "\nAfter Activating the Operator - ( )\n";
M.display( );
getch();
}
Dinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.
Related Articles
Basic Courses
Advance Courses