Skip to main content

Practice ยท 3 of 3

Member initialization order

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.

Difficulty: intermediate

Back to lesson: Practice: Classes, constructors, invariants