All pastes #499571 Raw Edit

Something

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

using namespace std;

class kans {
   public:
   int i;
   kans &operator++();
   const 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 &operator++()
{
   this->i++;
   return this;
}

const 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;
}