Summary Files Commits Branches @commit @diff @stats
path: root / Year 1 / Object-oriented Programming / Exam 2 / ex1 / String.h
diff options
context:
space:
mode:
1 files changed, 23 insertions, 0 deletions
-rw-r--r--Year 1/Object-oriented Programming/Exam 2/ex1/String.h23
diff --git a/Year 1/Object-oriented Programming/Exam 2/ex1/String.h b/Year 1/Object-oriented Programming/Exam 2/ex1/String.h
new file mode 100644
index 0000000..997093c
--- /dev/null
+++ b/Year 1/Object-oriented Programming/Exam 2/ex1/String.h
@@ -0,0 +1,23 @@
+#ifndef HEADER_STRING
+#define HEADER_STRING
+
+#include <ostream>
+
+class String {
+ char* str;
+ unsigned length;
+
+ void copyFrom(const String& other);
+ void free();
+public:
+ String(const char* str);
+
+ String();
+ String(const String& other);
+ String& operator=(const String& other);
+ ~String();
+
+ friend std::ostream& operator<<(std::ostream& ostr, const String& str);
+};
+
+#endif