title: Call methods on an object that will be created by other users
body: <p>How can I make sure that my classes will be able to call a method defined by me, on objects that will be defined by other users. </p>
  
  <p>I have structured my code following proper design patterns. And on top of the hierarchy   there is an abstract class that is extended by several classes, OTHER USERS will be able to  extend the top class. </p>
  
  <p>In a factory class some methods of the top class are called on the instances of the classes created by me and by the OTHER USERS. But I neither know how those classes are called by the users, how can I call methods on them in the factory class? </p>
  
  <ul>
  <li><code>CarGenerator</code>  (on top)</li>
  <li><code>BlueBiggerCar</code> [extends CarGenerator]</li>
  <li><code>SmallGreenCar</code> [extends CarGenerator]</li>
  <li><code>RedCar</code>        [extends CarGenerator]
  ...</li>
  </ul>
  
  <p>I let the possibility to the user to add new classes that extend <code>CarGenerator</code>, and on a Factory class as <code>ScreenFactory</code> the car are disposed on the screen as an example. </p>
  
  <p>In the factory <code>ScreenFactory</code> there will be something like: </p>
  
  <pre><code>new SmallGreenCar().appearOnScreen(); //A small green car appears on the screen.
  </code></pre>
  
  <p>but the users will add new cars as objects when my code will be released, in that case, how would those cars be able to appear on the screen if I cannot create an instance of them IN THE FACTORY? I'm wrong with the structure of the code probably but I can't understand how to fix. </p>