diff options
Update Person.cpp
1 files changed, 3 insertions, 0 deletions
| -rw-r--r-- | Sem. 07/Person/Person.cpp | 3 |
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;
|
