The presence of the Observer template.
class Observer
{
virtual eventA()=0;
virtual eventB()=0;
...
virtual eventZ()=0;
}
The Observer class cannot be changed, but my class is only interested in event B. Therefore, I need:
class MyObserver{
eventA() override {}
eventB() override { }
eventC() override {}
...
eventZ() override {}
}
Overhead for empty - implement all events, especially if you have a policy that is always implemented in cpp files (with the exception of templates).
Does C ++ 11 offer any keyword? how
...
eventC() override = empty;
...
This way, I will not need to add an empty implementation to the CPP file.
source
share