From 7e1fe0311f0414645bd3530635753a5ba9f8ca24 Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Wed, 4 May 2022 19:09:44 -0400 Subject: Update Person.cpp --- Sem. 07/Person/Person.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Sem. 07/Person/Person.cpp') diff --git a/Sem. 07/Person/Person.cpp b/Sem. 07/Person/Person.cpp index 3b241c7..14f337c 100644 --- a/Sem. 07/Person/Person.cpp +++ b/Sem. 07/Person/Person.cpp @@ -9,6 +9,7 @@ void Person::copyFrom(const Person& other) strcpy(name, other.name); age = other.age; } + void Person::free() { delete[] name; @@ -19,6 +20,7 @@ Person::Person(const char* name, int age) setName(name); setAge(age); } + Person::Person(const Person& other) { copyFrom(other); @@ -64,6 +66,7 @@ Person::~Person() { free(); } + void Person::print() const { std::cout << name << " " << age << std::endl; -- cgit v1.3.1-23-gd82d