Last active
December 8, 2019 19:53
-
-
Save YuriiSmolii/67e53d0971e1a37900220970aae0a760 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
using namespace std; | |
class Vector | |
{ | |
private: | |
unsigned size; | |
double* Arr; | |
public: | |
Vector(); | |
Vector(const Vector& a); | |
~Vector(); | |
Vector& operator++(); | |
Vector operator++(int); | |
}; | |
. | |
. | |
. | |
// Префіксний | |
Vector& Vector::operator++() | |
{ | |
for (int i = 0; i < size; ++i) | |
Arr[i] += 1; | |
return *this; | |
} | |
//------------------------------------------------------------------------------------------------ | |
//Постфіксний | |
Vector Vector::operator++(int) | |
{ | |
Vector copy(*this); | |
++(*this); | |
return copy; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment