From 6d4fa30cfd908e20a2ca2c70864a07007347ce98 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Tue, 19 Apr 2022 15:11:17 +0300 Subject: Added work from previous oop practice --- .../08-Practice-12.04.2022/Vector.h | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Year 1/Object-oriented Programming/08-Practice-12.04.2022/Vector.h (limited to 'Year 1/Object-oriented Programming/08-Practice-12.04.2022/Vector.h') diff --git a/Year 1/Object-oriented Programming/08-Practice-12.04.2022/Vector.h b/Year 1/Object-oriented Programming/08-Practice-12.04.2022/Vector.h new file mode 100644 index 0000000..7377c31 --- /dev/null +++ b/Year 1/Object-oriented Programming/08-Practice-12.04.2022/Vector.h @@ -0,0 +1,40 @@ +#pragma once +// #include +#include +#include +#include + +class Vector +{ + int* arr = nullptr; + int size; + int capacity; + + void resize(); + void free(); + void copyFrom(const Vector&); + + void swap(const int, const int); + +public: + Vector(); + Vector(const Vector&); + Vector& operator = (const Vector&); + ~Vector(); + + void push_back(const int); + int getSize()const; + int& operator [](const int); + const int& operator [](int)const ; + + void deleteAt(const int); + void pop_back(); + int findItem(const int) const; + void clear(); + void sort(); + void print() const; + void reverse(); +}; + +std::ostream& operator<<(std::ostream&, const Vector&); +std::istream& operator>>(std::istream&, const Vector&); -- cgit v1.3.1-23-gd82d