Summary Files Commits Branches @commit @diff @stats
path: root / Year 1 / Object-oriented Programming / 08-Practice-12.04.2022 / Vector.h
diff options
context:
space:
mode:
1 files changed, 40 insertions, 0 deletions
-rw-r--r--Year 1/Object-oriented Programming/08-Practice-12.04.2022/Vector.h40
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<exception>
+#include <stddef.h>
+#include <ostream>
+#include <fstream>
+
+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&);