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

Method Person

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

Source from the content-addressed store, hash-verified

4import <iostream>;
5
6Person::Person(size_t age, std::string_view name, Gender gender)
7 : m_age {age}, m_name {name}, m_gender {gender}
8{
9 // Instead of just initializing the members with the argument values,
10 // you could validate the arguments by doing reasonableness checks.
11 // e.g. Name mustn't be empty, and age should be less than 130 say.
12 // To handle a failure sensibly we really need exceptions,
13 // but we don't get to those until chapter 16.
14}
15
16// Display details of Person object
17void Person::who() const

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected