From a82a54f081ce561e6bc6e9f82869f8b40a47e660 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 25 May 2022 19:59:16 +0300 Subject: Added my work from today's exam --- .../Exam 2/ex1/String.h | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Year 1/Object-oriented Programming/Exam 2/ex1/String.h (limited to 'Year 1/Object-oriented Programming/Exam 2/ex1/String.h') 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 + +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 -- cgit v1.3.1-26-gb76a