 <p>C++ does not have a base object that all objects inherit from, unlike Java. The usual approach for what you want to do would be to use <a href="http://www.parashift.com/c++-faq-lite/templates.html" rel="nofollow noreferrer">templates</a>. All the containers in the standard C++ library use this approach. </p> <p>Unlike Java, C++ does not rely on polymorphism/inheritance to implement generic containers. In Java, all objects inherit from <code>Object</code>, and so any class can be inserted into a container that takes an <code>Object</code>. C++ templates, however, are compile time constructs that instruct the compiler to actually generate a different class for each type you use. So, for example, if you have:</p> <pre><code>template &lt;typename T&gt; class MyContainer { ... }; </code></pre> <p>You can then create a <code>MyContainer</code> that takes <code>std::string</code> objects, and another MyContainer that takes <code>int</code>s. </p> <pre><code>MyContainer&lt;std::string&gt; stringContainer; stringContainer.insert("Blah"); MyContainer&lt;int&gt; intContainer; intContainer.insert(3342); </code></pre>