-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathViolation.cpp
More file actions
38 lines (37 loc) · 791 Bytes
/
Violation.cpp
File metadata and controls
38 lines (37 loc) · 791 Bytes
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
#include "Violation.h"
Violation::Violation() {
name = nullptr;
fine = 0;
}
Violation::Violation(char* n, int f) {
fine = f;
name = nullptr;
copyArray(n, name);
}
Violation::Violation(const Violation& other) {
fine = other.fine;
name = nullptr;
if (other.name) {
copyArray(other.name, name);
}
}
Violation& Violation::operator=(const Violation& other) {
if (this != &other) {
delete[] name;
name = nullptr;
fine = other.fine;
if (other.name) {
copyArray(other.name, name);
}
}
return *this;
}
Violation::~Violation() {
delete[] name;
}
char* Violation::getName() const {
return name;
}
int Violation::getFine() const {
return fine;
}