CppPatterns-Patterns
CppPatterns-Patterns copied to clipboard
Suggestion: In the CRTP example, make impl method private in the derived class
Method do_something_impl
is private
in the base class and public
in the derived class foo
.
https://github.com/sftrabbit/CppPatterns-Patterns/blob/a222c8438d2c9e81114b9408c2e6a8e767bffb0b/common-tasks/classes/delegate-behavior-to-derived-classes.cpp#L21-L28
For consistency, make do_something_impl
private.
class foo : public base<foo>
{
friend class base<foo>;
private:
void do_something_impl()
{
// Derived implementation
}
};