19.5. Nested Classes
A class can be defined within another class. Such a class is a nested class, also referred to as a nested type. Nested classes are most often used to define implementation classes, such as the QueryResult class we used in our text query example (§ 12.3, p. 484).
Exercises Section 19.4.3
Exercise 19.18: Write a function that uses count_if to count how many empty strings there are in a given vector.
Exercise 19.19: Write a function that takes a vector<Sales_data> and finds the first element whose average price is greater than some given amount.
Nested classes are independent classes and are largely unrelated to their enclosing class. In particular, objects of the enclosing and nested classes are independent from each other. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access