title: Instantiation of objects in conditionals c++
body: <p>let's say I want to instantiate a different type of object depending on certain circumstances, so i would instantiate them inside the body of an if statement.  The problem is if you want to use that object later, you need to declare it before instantiation.  How does one declare a generic object.  Is there something similar to the object class in Java?  </p>
  
  <p>I've done some google searching like "generic object c++" and "object class c++" and there doesn't appear to be something like that.  </p>