-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBird.h
59 lines (48 loc) · 1.05 KB
/
Bird.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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: Bird.h
* Author: dj2
*
* Created on February 19, 2018, 11:42 AM
*/
#ifndef BIRD_H
#define BIRD_H
#include "Pet.h"
class Bird : public Pet {
private:
bool nocturnal;
public:
Bird(string n, string t, double p, unsigned int w, bool f):
Pet(n, t, p, w), nocturnal(f) {}
Bird(const Bird& bird): Pet(bird) {
if (this != &bird) {
nocturnal = bird.nocturnal;
}
}
Bird& operator=(const Bird& bird) {
if (this != &bird) {
Pet::operator=(bird);
nocturnal = bird.nocturnal;
}
return *this;
}
virtual ~Bird() {}
bool getNocturnal() const {
return nocturnal;
}
void SetNocturnal(const bool n) {
nocturnal = n;
}
void print() const {
Pet::print();
cout << "nocturnal: " << nocturnal << endl;
}
void Accept(Visitor *v){
v->VisitBird(this);
}
};
#endif /* BIRD_H */