Advertisement
Guest User

sosijopu

a guest
Jan 24th, 2020
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class A
  6. {
  7.    private:
  8.    {
  9.        int a;
  10.        int b;
  11.    }
  12.  
  13.    public:
  14.        A(int n) {
  15.            a = n;
  16.        }
  17.  
  18.    {
  19.        A& operator++(); // префикс
  20.        A operator++(int); // постфикс
  21.  
  22.        A& A::operator++() {
  23.            ++a
  24.            return *this;
  25.        }
  26.        A A::operator++(int) {
  27.            A temp(a);
  28.  
  29.            ++(*this);
  30.  
  31.            return temp;
  32.        }
  33.    }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement