Skip to main content

Practice ยท 3 of 3

A protected extension point

Implement class Greeter with std::string greet() const returning "Hello, " + salutation() where salutation() is a protected member function returning "world". Implement class FormalGreeter : public Greeter overriding nothing but the base stays intact โ€” the test calls both through their own types.

Difficulty: intermediate

Back to lesson: Practice: Inheritance mechanics