title: Return a function from multiple derived classes
body: <p>I have a base class and multiple derived classes from it. Each derived class has a constructor that accepts parameters that were initialized in the base class. All of the constructors are different, however they all accept one common parameter, let's call it <code>Name</code>. </p>
  
  <p>Is there a way for me to display every derived class' name in a shorter way than calling them one after another?</p>
  
  <p>Here's an example. Let's say my base class is <code>Father</code> and my derived classes are <code>Brother, Sister, HalfBrother, HalfSister</code> and this is my driver file:</p>
  
  <pre><code>cout &lt;&lt; Brother::Brother().getName() &lt;&lt; endl
       &lt;&lt; Sister::Sister().getNAme() &lt;&lt; endl
       &lt;&lt; HalfBrother::HalfBrother().getNAme() &lt;&lt; endl
       &lt;&lt; HalfSister::HalfSister().getName() &lt;&lt; endl;
  </code></pre>
  
  <p>This will return them fine, but is there a simpler way to do this so that I can get all the names from all the derived classes without having to write them one by one?</p>