 <p>There's no need for inheritance here. Just use <code>std::function</code> to store the member function pointers and <code>std::bind</code> to bind together the member function pointer and the object instance.</p> <pre><code>#include &lt;functional&gt; #include &lt;map&gt; #include &lt;string&gt; #include &lt;iostream&gt; struct Apple { void Red () { std::cout &lt;&lt; "aa\n"; } }; struct Orange { void Blue () { std::cout &lt;&lt; "bb\n"; } }; int main() { std::map&lt;std::string, std::function&lt;void()&gt;&gt; m; Apple a; Orange o; m["apple"] = std::bind(&amp;Apple::Red, a); m["orange"] = std::bind(&amp;Orange::Blue, o); m["apple"](); m["orange"](); } </code></pre> <p>Output:</p> <pre><code>aa bb </code></pre>