-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtree.h
77 lines (47 loc) · 1.16 KB
/
tree.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//
// Created by antronyx on 03/02/19.
//
#ifndef ANTOCOON_TREE_H
#define ANTOCOON_TREE_H
#endif
#include <iostream>
#include <string>
#include <iomanip>
#include <zconf.h>
using namespace std;
class Person {
private:
string name;
Person *father = NULL;
Person *mother = NULL;
public:
Person(string _name) {
this->name = _name;
}
Person();
Person(const Person &obj) { /** Declaring Copy-Constructor **/
name = obj.name;
this->father = obj.father;
this->mother = obj.mother;
}
string getName() { return name; }
Person *getFather() { return this->father; }
void setFather(Person *_father) {
if (this->father == NULL) { this->father = _father; }
}
Person *getMother() { return this->mother; }
void setMother(Person *_mother) {
if (this->mother == NULL) {
this->mother = _mother;
}
}
void printSimple();
void printFather();
void printMother();
void setName(string _name) {
this->name = _name;
}
void saveTree(int count);
void printTree(Person *p, int indent);
void setFile(string _file_name);
};