Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 11 / Examples / Bar / MyString / MyString.h
diff options
context:
space:
mode:
Commit4993c6468aa07e7c6a006a721fe82aaa4413eede (patch)
Author
 angeld55 <angel_dimitriev@abv.bg>
2022-05-17 20:42:42 +0300
Committer
 angeld55 <angel_dimitriev@abv.bg>
2022-05-17 20:42:42 +0300
Files819dc184dc1c4d23ff71bdd5d9d538b8ce32a5de /Sem. 11/Examples/Bar/MyString/MyString.h
Object-oriented_programming_FMI-4993c6468aa07e7c6a006a721fe82aaa4413eede.tar
Object-oriented_programming_FMI-4993c6468aa07e7c6a006a721fe82aaa4413eede.tar.gz
Object-oriented_programming_FMI-4993c6468aa07e7c6a006a721fe82aaa4413eede.zip
Parent8af74b1eeed52119ecaaf57ff6779edbc219c34b (diff)
added bar task
1 files changed, 44 insertions, 0 deletions
-rw-r--r--Sem. 11/Examples/Bar/MyString/MyString.h44
diff --git a/Sem. 11/Examples/Bar/MyString/MyString.h b/Sem. 11/Examples/Bar/MyString/MyString.h
new file mode 100644
index 0000000..b37733a
--- /dev/null
+++ b/Sem. 11/Examples/Bar/MyString/MyString.h
@@ -0,0 +1,44 @@
+#pragma once
+
+#include <fstream>
+class MyString
+{
+ char* str;
+ size_t size;
+
+ void copyFrom(const MyString& other);
+ void free();
+
+public:
+ MyString();
+ MyString(const char*);
+
+ MyString(const MyString&);
+
+ MyString(MyString&&); //move constructor that accepts rvalue;
+
+ MyString& operator=(const MyString& other);
+ MyString& operator=(MyString&& other); //move op= that accepts rvalue;
+
+ ~MyString();
+
+ size_t getSize() const;
+ void concat(const MyString& other);
+
+ const char* c_str() const;
+
+ MyString& operator+=(const MyString& other);
+
+ friend std::ostream& operator<<(std::ostream& stream, const MyString& str);
+ friend std::istream& operator>>(std::istream& stream, MyString& str);
+
+};
+
+MyString operator+(const MyString& lhs, const MyString& rhs);
+
+bool operator==(const MyString& lhs, const MyString& rhs);
+bool operator<=(const MyString& lhs, const MyString& rhs);
+bool operator<(const MyString& lhs, const MyString& rhs);
+
+
+//MyString name = "sdfsdf" \ No newline at end of file