title: How to polymorphic call a method from a stack of two different child types
body: <p>I have 4 separate classes UI, Parent, child1 and child2.
  I have a parent stack containing both child1 and child2.
  I'm trying to call a method when iterating through the stack that changes depending on whether it is of type child1 or child2.</p>
  <p>I've tried creating an abstract method in parent and overriding the method in child1 and child2 but it says method does not override or implement from super type.</p>
  <p>I've tried to make a public empty method in parent and override the methods in each child case but when I call the method from main in UI it calls the empty method.</p>
  <p>I found a workaround by looking at instanceof in the stack which worked but I ran into issues later in the program trying to save/load data. Please see rough code below and any questions let me know.</p>
  <pre><code>public abstract class parent {
  
      public void addToPuzzle(){};
  
  }
  
  public class child1 extends parent {
  
      public void addToPuzzle(abc)
  }
  
  
  public class child2 extends parent {
  
      public void addToPuzzle(wxyz)
  }
  
  public class ui{
  
      public void undoMove(){
          for(parent p : oldStack){
              p.addToPuzzle();
          }
      }
  }
  </code></pre>