Abstract Methods and Classes
Whenever a class contains a method only for the purpose of
overriding but does not have any body such methods has to be declare as
Abstract Methods. Once a class contains at least one abstract method the class
must be declared as abstract and for an abstract class we cannot create any
instances but it can be inherited. Every method in the abstract class has to be
override.
Ex: abstract
class common
{
abstract
void assign();
abstract
void show();
}
No comments:
Post a Comment