I want to be able to tell at run-time if an instance of a class implements a virtual function. For example:
struct Base
{
virtual void func(int x) { <
What comes to my mind right now is to have a special "counter" variable, which will take its value based on the implementation and zero if the base-class function is called. I think that this sounds a bit obsolete style though and try to find a better solution in a moment. See the example for now:
struct Base
{
virtual void func(int x, int& implemented) {implemented = 0;}
};
struct Deriv : Base
{
virtual void func(int x, int& implemented) override {implemented = 1;}
};
If the functions are void as in your example, you also can use "return codes" - just return implemented value back.