title: Android - how to force child to override parent method that has code
body: <p>Here's the scenario -> imagine there are 3 classes, i want to do something kind of like:</p>
  
  <pre><code>public class GameObject {
      public void updateBounds() {
          // do something
      }
  }
  
  public abstract class Enemy extends GameObject {
      public abstract void updatePosition(){ //&lt;-- this will not compile, 
                                      //but this is what i want to do, to force 
                                      //child to override parent method
          updateBounds();
      }
  
  }
  
  public class Minion extends Enemy {
      @Override
      public void updatePosition() {
          super.updatePosition(); // &lt;-- how do i throw an exception if this line
                                  // is not called within this method of the
                                  // child?
          // now do something extra that only Minion knows how to do
      }
  }
  </code></pre>
  
  <ul>
  <li>how do you design the Enemy class so that it has a method which does something, but requires every child to override it?</li>
  <li>how do you force the child (who had to override the method) to also call the parent's method?</li>
  </ul>
  
  <p>this is almost like Android's  <code>Activity</code> class that has the onCreate, onStart, onResume...etc. methods that are optional, but if you make use of it, it forces you to call super. it can't be abstract because i want some code to be run when the method is called (which is only in the parent class's method). bonus points if u know how they did it this way?</p>