From 5dda3a1f40e4e8f621b20f374c02b6d1e241e7cf Mon Sep 17 00:00:00 2001 From: angeld55 Date: Tue, 10 May 2022 20:06:53 +0300 Subject: sem 11 --- Sem. 11/Examples/Person/Person.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Sem. 11/Examples/Person/Person.h (limited to 'Sem. 11/Examples/Person/Person.h') diff --git a/Sem. 11/Examples/Person/Person.h b/Sem. 11/Examples/Person/Person.h new file mode 100644 index 0000000..826b671 --- /dev/null +++ b/Sem. 11/Examples/Person/Person.h @@ -0,0 +1,27 @@ +#pragma once +#include +class Person +{ + char* name = nullptr; + int age = 0; + + void copyFrom(const Person& other); + void free(); + +public: + Person() = default; + Person(const char* name, int age); + + Person(const Person& other); + Person& operator=(const Person& other); + + const char* getName() const; + int getAge() const; + + ~Person(); + void print() const; + +protected: + void setName(const char* name); + void setAge(int age); +}; -- cgit v1.3.1-23-gd82d