Abstract class:-
A class
can have a method(no body of the function), then that should be declared as
abstract method and whose class should be declared as abstract class.
An
abstract class can have both abstract and non-abstract methods.
Since abstract class can not be instantiated,
it should have atleast one derived class.
Abstract
methods should be overridden by derived classes whereas non-abstract methods
may or may not be overridden by derived classes.
It is
used to achieve dynamic polymorphism.
Syntax
======
accesspecifier
abstract class classname
{
accessspcifier
abstract rtype mname(arg,,,,);
non abs
method definition(instance & static)
}
No comments:
Post a Comment