Nov 11, 2023

Calling C++ class methods by its string name

Consider the following cases:
  1. You have an abstract class that you use as an interface for other classes deriving from it. The abstract class just have the bare minimum methods for interacting with it or none at all, derived classes can define new methods, you can only get access to the derived class object by the abstract class. You want to call a method in the derived class from the abstract class.
  2. You have a class where you want to add new methods dynamically, but it's definitions are unknown.