What is the simplest way to create and call dynamically a class method in C++?

后端 未结 8 1146
太阳男子
太阳男子 2021-01-01 05:28

I want to fill a map with class name and method, a unique identifier and a pointer to the method.

typedef std::map

        
8条回答
  •  萌比男神i
    2021-01-01 06:08

    You can try using factory or abstract factory design patterns for the class, and a function pointer for the function.

    I found the following 2 web pages with implementations when I was searching for solutions for a similar problem:

    Factory

    Abstract factory

提交回复
热议问题