All pastes #499646 Raw Edit

Something

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

using namespace std;

class kans {
   public:
   int i;
   // Prefix operator
   kans &operator++();
   // Postfix Operator
   const kans operator++(int);
   kans &kans::operator= (kans const& p1);
};

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

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

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

int main()
{
    kans p1,p2;
    p1.i = 10;
    p2 = p1++;
    cout << p1.i << "  " << p2.i << endl;
}