Skip to main content

Practice · 3 of 3

Member initialization order

CHALLENGE
Difficulty: intermediate+25 XP

Implement class EventLog with members std::string name_; then int id_; declared IN THAT ORDER, a constructor EventLog(int id, std::string name) initializing both via the member initializer list, and getters const std::string& name() const / int id() const.

Back to lesson: Practice: Classes, constructors, invariants