I just learned to my amazement that the following is legal C++
struct A {
void foo(int) const = 0; // pure virtual
// ...
};
void A::foo(int) const { /* ... */ }
What are sensible use cases for this? I.e. when would A::foo
ever be called and why is this the correct/best implementation? Are there any differences here between C++03 and C++11?
Okay, there was a previous question (which I didn't find) with the same intention. However that was pre C++11. So my last question remains valid.