Axaptapedia is now maintained by AgileCadence For more information please click here.

Abstract methods

From Axaptapedia
Jump to: navigation, search

Abstract methods are used when you wish to force the developer of a sub-class to override the method and provide functionality.

Methods are declared as abstract by using the abstract keyword, for example

<xpp> public abstract void abstractMethod() { } </xpp> No code or declarations are allowed inside an abstract method.

It is not possible to declare a method as abstract unless the class is also declared as abstract. See abstract classes.

If a sub-class is created which does not override the abstract methods in its parent, then a compile error will occur where that sub-class is used.