-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGunslinger.cpp
60 lines (50 loc) · 1.13 KB
/
Gunslinger.cpp
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
/*
@file Gunslinger.cpp
@author Sean Resor
@date 4/12/21
*/
#pragma once
#include <iostream>
#include "Gunslinger.h"
gunslinger::gunslinger() : person()
{
draw = 0;
notches = 0;
}
// Constructor for the Gunslinger class
gunslinger::gunslinger(const char* fN, const char* lN, double d, int n) : person(fN, lN)
{
draw = d;
notches = n;
}
// Draw function to print the Gunslinger's draw time
double gunslinger::Draw()
{
return draw;
}
// Show function to print the first and last names, the draw speed, and the number of notches
void gunslinger::Show()
{
cout << "The gunslinger is: ";
cout << getFirstName() << " " << getLastName() << endl;
cout << "Draw speed: " << draw << endl;
cout << "Gun notches: " << notches << endl << endl;
}
// Returns the draw speed of the Gunslinger
double gunslinger::getDraw()
{
return draw;
}
// Returns the number of notches on the Gunslinger's gun
int gunslinger::getNotches()
{
return notches;
}
// Overloads the assignment operator for the Gunslinger class
gunslinger& gunslinger::operator=(gunslinger const& x)
{
person::operator=(x);
draw = x.draw;
notches = x.notches;
return *this;
}