-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCat.h
More file actions
80 lines (63 loc) · 1.63 KB
/
Cat.h
File metadata and controls
80 lines (63 loc) · 1.63 KB
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
78
79
/*
* 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: Cat.h
* Author: Chris Frey
*
* Created on February 11, 2018, 8:21 PM
*/
#ifndef CAT_H
#define CAT_H
#include "Pet.h"
#include <string>
#include <iostream>
#include <iomanip>
class Cat : public Pet{
protected:
bool m_fluffy = false;
public:
// Default Constructor
Cat() : Pet(){}
// Constructor
Cat(std::string name, std::string type, double price, unsigned int weight, bool fluffy)
: Pet(name,type,price,weight,"Cat"){
m_fluffy = fluffy;
}
// Destructor
virtual ~Cat(){}
// Copy constructor
Cat(const Cat& Ct)
: Pet(Ct){
if (this != &Ct){
m_fluffy = Ct.m_fluffy;
}
}
// Assignment operator
Cat& operator=(const Cat& Ct){
if (this != &Ct){
this->Pet::operator=(Ct);
m_fluffy = Ct.m_fluffy;
}
return *this;
}
bool GetFluffy() const {
return m_fluffy;
}
void SetFluffy(bool input){
m_fluffy = input;
}
virtual void print() const {
cout << std::fixed << std::setprecision(2);
std::cout << std::boolalpha;
std::cout << "Name: " << m_name << " ";
std::cout << "Type: " << m_type << " ";
std::cout << "Weight: " << m_weight << " ";
std::cout << "Price: " << m_price << " ";
// Special trait
std::cout << "Fluffy: " << m_fluffy << " " << std::endl;
}
};
#endif /* CAT_H */