-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParty.h
37 lines (36 loc) · 1.07 KB
/
Party.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
#pragma once
#include "Citizen.h"
#include <iostream>
using namespace std;
namespace votes
{
class Citizen;
class Party
{
private:
string _partyName;
Citizen* _leader;
int _partySerial;
static int partyCounter;
public:
//ctors/dtors:
Party() { _leader = nullptr; _partySerial = 0; }
Party(const string& partyName, Citizen* leader);
// we don't use a "Party" by-val initing, but we make sure no code will be using default operator '=' or 'copy ctor' by cancelling them.
Party& operator=(const Party& other) = delete;
Party(const Party& other) = delete;
//getters:
const string getPartyName() const { return _partyName; }
const Citizen* getLeader() const { return _leader; }
const int getPartySerial() const { return _partySerial; }
const int getPartyCounter() const { return partyCounter; }
//setters
void resetCounter() { partyCounter = 0; }
void setLeader(Citizen* leader) { _leader = leader; }
//
friend ostream& operator<<(ostream& os, const Party& party);
//save/load
void saveParty(ostream& out) const;
void loadParty(istream& in);
};
}