But the problem here is that each one of them(a.cpp/h and a_mockup.cpp/h) uses the singelton pattern(contains static functions) and static functions cannot be virtually declared in the baseclass.
Is there a way to solve this problem?
CodePudding user response:
In C Virtual functions are invoked during run-time, when you have a pointer/reference to an instance of a class. Static functions aren't bind to a particular instance, they're bind to a class during compile-time. Moreover, C doesn't have pointers-to-class functionality. So, there is no such way to solve this.
CodePudding user response:
You must have CRTP as your default design when aiming for static polymorphism.

