diff options
| author | Syndamia <kamen@syndamia.com> | 2024-04-04 20:11:12 +0300 |
|---|---|---|
| committer | Syndamia <kamen@syndamia.com> | 2024-04-04 20:11:12 +0300 |
| commit | a2e284b0056075e2365deaa2455be567c3b3c945 (patch) | |
| tree | 8a842d1f2ffb9f00989b39d2ab7a7ade1a858d81 /week07/Exercise6.h | |
| parent | 44d085f265583f0e3cbef294bbe2c8e300aaa452 (diff) | |
| download | oop-2023-solutions-a2e284b0056075e2365deaa2455be567c3b3c945.tar oop-2023-solutions-a2e284b0056075e2365deaa2455be567c3b3c945.tar.gz oop-2023-solutions-a2e284b0056075e2365deaa2455be567c3b3c945.zip | |
[w7] Added exercise descriptions and solutions
Diffstat (limited to 'week07/Exercise6.h')
| -rw-r--r-- | week07/Exercise6.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/week07/Exercise6.h b/week07/Exercise6.h new file mode 100644 index 0000000..ab5df9e --- /dev/null +++ b/week07/Exercise6.h @@ -0,0 +1,27 @@ +#include <iostream> + +class Matrix { + int values[4]; + + void addBy(int amount); + +public: + Matrix(int a, int b, int c, int d); + + Matrix& operator++(); + Matrix operator++(int); + Matrix& operator--(); + Matrix operator--(int); + + Matrix& operator+=(const Matrix& rhs); + Matrix& operator-=(const Matrix& rhs); + Matrix& operator*=(const Matrix& rhs); + + friend Matrix operator+(const Matrix& lhs, const Matrix& rhs); + friend Matrix operator-(const Matrix& lhs, const Matrix& rhs); + friend Matrix operator*(const Matrix& lhs, const Matrix& rhs); + + friend std::ostream& operator<<(std::ostream& lhs, const Matrix& rhs); + friend std::istream& operator>>(std::istream& lhs, Matrix& rhs); +}; + |
