Tip for overriding methods

  • April 19, 2010
  • 3 Comments

There is a simple and generic way to force overriding a method you created. To do so you just need create your new method and place a ‘throw error’ statement in it. To finish you can add the static method missingOverride from the error class and the funcName() to your error. Now when this method is called or the super() in you child class is called, you will get a error that you need to override your method.

public identifiername myMethod()
{
    throw  error(Error::missingOverride(funcName()));
}

When you use this peace of code you will get the following error:

Note: The error-class also has some other usefull static methods like: missingFormActiveBuffer, missingOverload, missingOverride, missingParameter, missingRecord and my favorite wrongUseOfFunction