All pastes #499473 Raw Edit

Something

public text v1 · immutable
·published 2007-05-21 02:21 UTC
rendered paste body
#include <iostream>

using namespace std;

class kans {

   public:
   int i;
   kans operator++(int);
   kans operator= (int i);
   kans kans::operator= (kans& p1);
   friend ostream& operator<< (ostream& s,kans j)
   {
           s << j.i;
           return s;
   }

};

kans kans::operator++ (int j)
{
   this->i++;
   return *this;
}

kans kans::operator= (int i)
{
   this->i = i;
   return *this;
}

kans kans::operator= (kans& p1)
{
  this->i = p1.i;
  return *this;
}



int main()
{
    cout << "Hi How are you are in C++?" << endl ;
    kans p1,p2;
    p1 = 10;
    p2 = p1++;
    cout << p1 << "  " << p2 << endl;
}