Selectively inheriting from any of multiple classes at runtime : <p>I'm doing scientific computing and I'm beginner in c++. <code>MyNLP</code> is a class which contain all the problem data and methods. I'm using third party libraries for numerical optimization. Each third party is a specific algorithm to solve my problem. In order to use each library, my <code>MyNLP</code> class need to inherit corresponding class from third party library.</p>

<p>For example,</p>

<pre><code>Class MyNLP :public IPOPT
{
};
</code></pre>

<p>enable me to use IPOPT algorithm to solve my problem. Similarly, </p>

<pre><code>class MyNLP: public SQP
{
};
</code></pre>

<p>enable me to use SQP algorithm.</p>

<p>But in my case, only at the run-time, program decides which class it should inherit. I have to inherit either one of third party class.
Could any one give a  technique to achieve this in cpp? </p>
