-
Notifications
You must be signed in to change notification settings - Fork 18
/
chromium.cpp
84 lines (69 loc) · 1.73 KB
/
chromium.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <iostream>
namespace western {
enum ShootingHand { LEFT, RIGHT };
class Cowboy {
public:
Cowboy();
Cowboy(int GunCount);
~Cowboy();
void Shoot(std::string who);
int get_age() { return age_; } // minor functions have lower case
protected:
void MakeBang(const int& how_many);
int gun_count_;
int age_;
};
Cowboy::Cowboy() : age_(45), gun_count_(2) {
std::cout << "I am alive!" << std::endl;
}
Cowboy::Cowboy(int gun_count) : age_(45), gun_count_(gun_count) {
// And this is the longest inline comment you have every seen. Lorem Ipsum.
// Bacon! Cheese. Bread. Beer. Fish. Mobile fridge. More random words come
// here...
std::cout << "Howdy!" << std::endl;
}
Cowboy::~Cowboy() {
std::cout << "RIP" << std::endl;
}
void Cowboy::Shoot(std::string who) {
age_++;
int someNumber = 5 + 7 * 3;
MakeBang(someNumber);
if (someNumber > 10) {
return;
}
switch (age_) {
case 45:
age_--;
break;
default:
age_++;
}
}
void Cowboy::MakeBang(const int& how_many) {
for (int i = 0; i < how_many; ++i)
std::cout << "Bang!" << std::endl;
}
void someVeryLongMethod(int param1,
int param2,
int param3,
int param4,
int param5,
int param6,
int param7,
int param8,
int param9,
int param10) {
std::cout << "So long..." << std::endl;
}
} // namespace western
using namespace western;
int main() {
Cowboy Amy;
Cowboy Angus(2);
Cowboy* current_cowboy = &Amy;
current_cowboy->Shoot("yourself");
return 0;
}
// ADDITIONAL NOTES:
// - Chromium mostly follows Google.