MCPcopy Create free account
hub / github.com/Apress/beginning-cpp20 / main

Function main

Exercises/Modules/Chapter 14/Soln14_04/Soln14_04.cpp:7–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5import person;
6
7int main()
8{
9 std::vector<Employee> employees
10 {
11 Employee{ 21, "Randy Marathon", Gender::male, 34567 },
12 Employee{ 32, "Anna Pothecary", Gender::female, 34578 },
13 Employee{ 46, "Peter Out", Gender::male, 34589 },
14 Employee{ 37, "Sheila Rangeit", Gender::female, 34598 },
15 Employee{ 65, "Jack Ittin", Gender::male, 34667 }
16 };
17
18 for (const auto& employee : employees)
19 employee.who();
20
21 std::cout << std::endl;
22
23 // Note: explicitly specifying the type in front of every {...}
24 // in a vector's initializer list, like we did for Employees,
25 // is actually not required...
26 std::vector<Executive> executives
27 {
28 { 44, "Irwin Pootlemeyer", Gender::other, 35567 },
29 { 32, "Alexa Workwell", Gender::female, 35578 },
30 { 42, "Steve Stove", Gender::male, 35589 },
31 { 33, "Sue Neenuf", Gender::female, 35598 },
32 { 29, "Melanie Clair", Gender::female, 35667 }
33 };
34
35 for (const auto& executive : executives)
36 {
37 executive.who();
38 executive.Employee::who(); // Executive, I shall know thy age!
39 }
40}

Callers

nothing calls this directly

Calls 1

whoMethod · 0.45

Tested by

no test coverage detected