Virtual functions can also be implemented directly using function pointers like this.
struct A { void (*foo)(A *thiz); void (*goo)(A *thiz, int x); };
But obviously this is less efficient than regular implementations. And in fact, C ++ implementations may be slightly different when working with inheritance multiplication and virtual base classes.
source share