-
Notifications
You must be signed in to change notification settings - Fork 1
/
SingleResponsibilityPrinciple.cpp
59 lines (39 loc) · 1.05 KB
/
SingleResponsibilityPrinciple.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
//
// Created by Amit Kumar on 17/09/23.
//
#include "string"
#include "fstream"
using namespace std;
class Movie {
private:
string name;
string releaseMonth;
int releaseYear;
public:
Movie(const string &name, const string &releaseMonth, int releaseYear) : name(name), releaseMonth(releaseMonth),
releaseYear(releaseYear) {}
const string &getName() const {
return name;
}
const string &getReleaseMonth() const {
return releaseMonth;
}
int getReleaseYear() const {
return releaseYear;
}
};
class StorageManager {
public:
static void saveInfo(const Movie &movie, const string &filename) {
fstream ofs(filename);
ofs << movie.getName() << endl;
ofs << movie.getReleaseMonth() << endl;
ofs << movie.getReleaseYear() << endl;
ofs.close();
}
};
int main() {
Movie movie{"firstMovie", "Jan", 2000};
StorageManager::saveInfo(movie, "newFileName");
return 0;
}