-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFish.h
More file actions
80 lines (64 loc) · 1.69 KB
/
Fish.h
File metadata and controls
80 lines (64 loc) · 1.69 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: Fish.h
* Author: Chris Frey
*
* Created on February 11, 2018, 8:21 PM
*/
#ifndef FISH_H
#define FISH_H
#include "Pet.h"
#include <string>
#include <iostream>
#include <iomanip>
class Fish : public Pet{
protected:
std::string m_enviro = "";
public:
// Default Constructor
Fish() : Pet(){}
// Constructor
Fish(std::string name, std::string type, double price, unsigned int weight,
std::string enviro)
: Pet(name,type,price,weight,"Fish"){
m_enviro = enviro;
}
// Destructor
virtual ~Fish(){}
// Copy constructor
Fish(const Fish& fsh)
: Pet(fsh){
if (this != &fsh){
m_enviro = fsh.m_enviro;
}
}
// Assignment operator
Fish& operator=(const Fish& fsh){
if (this != &fsh){
this->Pet::operator=(fsh);
m_enviro = fsh.m_enviro;
}
return *this;
}
std::string GetEnviro() const {
return m_enviro;
}
void SetEnviro(std::string input){
m_enviro = 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 << "Enviroment: " << m_enviro << " " << std::endl;
}
};
#endif /* FISH_H */