using namespace std;
#include <iostream>
class OverLoading
{
   private:
   int value;
   public:
   OverLoading()
   { value = 0;}
   OverLoading(int c)
   { value = c;}
   friend OverLoading operator-(OverLoading &S1, OverLoading &S2);
   void printValue()
   {
      cout<<"Value is : "<<value<<endl;
   }
};
OverLoading operator-(OverLoading &S1, OverLoading &S2)
{
   OverLoading S;
   S = S1.value-S2.value;
   return S;
}
int main()
{
   int i = 0;
   OverLoading S1(600);
   OverLoading S2(200);
   OverLoading S3;
   S3 = S1 - S2;
   cout<<"S1 :"<<endl;
   S1.printValue();
   cout<<"S2 :"<<endl;
   S2.printValue();
   cout<<"S3 :"<<endl;
   S3.printValue();
   return 0;
}
Comments
Leave a comment