-
Notifications
You must be signed in to change notification settings - Fork 33
/
sport.h
80 lines (61 loc) · 2.5 KB
/
sport.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
78
79
80
//*****************************************************************************************************
// Sport Class Header File
//
// This header file defines the private and public members and methods of the Sport class and
// defines the inline functions (getters and setters).
//
// Other files required:
// 1. date.h - header file for Date class
//
//*****************************************************************************************************
#ifndef SPORT_H
#define SPORT_H
//*****************************************************************************************************
#include "date.h"
#include <string>
//*****************************************************************************************************
class Sport {
private:
std::string name;
Date nextGame; // use Date class to store date of next game
int numTeams;
std::string *teamNames;
public:
Sport(const std::string &n = ""); // default argument so that Sport object can be created without arguments
~Sport();
std::string getName() const; // const used when methods do not change the object's data members
void setName(const std::string &n);
Date getDate() const;
void setDate(const Date &d);
int getNumTeams() const;
void setNumTeams(const int &n);
void display() const;
void populate();
void addTeam(const std::string &n);
};
//*****************************************************************************************************
inline std::string Sport::getName() const {
return name;
}
//*****************************************************************************************************
inline void Sport::setName(const std::string &n) {
name = n;
}
//*****************************************************************************************************
inline Date Sport::getDate() const {
return nextGame;
}
//*****************************************************************************************************
inline void Sport::setDate(const Date &d) {
nextGame = d;
}
//*****************************************************************************************************
inline int Sport::getNumTeams() const {
return numTeams;
}
//*****************************************************************************************************
inline void Sport::setNumTeams(const int &n) {
numTeams = n;
}
//*****************************************************************************************************
#endif