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 "
public abstract void abstractMethod()
{
}
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.
·
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.
No comments:
Post a Comment