abstract method:
•In inheritance, the superclass contains the general characteristics and general behavior(methods) of all the methods.
•In some situations we might want the methods in the superclass to be general and the subclass can override these methods to specify their own behavior.
•This can be achieved by declaring a method in the superclass as “abstract”. An abstract method will have no body.
•Syntax of an “abstract” method is as follows:
abstract return-type method-name(parameter list);
•An abstract method has the following characteristics:
1) An abstract method has no body.
2) An abstract method can only be declared in an abstract class.
3) An abstract method must be definitely overrided in the subclass.
4) We cannot declare abstract static methods.
5) We cannot create abstract constructors.
abstract class:
•A class which is declared with “abstract” keyword is called an abstract class. Syntax is as follows:
abstract class ClassName
{
members;
}
•An abstract class can contain both concrete methods(methods which have body) and abstract methods (with no body).
•We cannot create an object for an abstract class. There is no meaning in creating objects as the class in not fully defined.
•All the abstract methods in the abstract class must be overriden in the subclass which extends this abstract superclass.
•In inheritance, the superclass contains the general characteristics and general behavior(methods) of all the methods.
•In some situations we might want the methods in the superclass to be general and the subclass can override these methods to specify their own behavior.
•This can be achieved by declaring a method in the superclass as “abstract”. An abstract method will have no body.
•Syntax of an “abstract” method is as follows:
abstract return-type method-name(parameter list);
•An abstract method has the following characteristics:
1) An abstract method has no body.
2) An abstract method can only be declared in an abstract class.
3) An abstract method must be definitely overrided in the subclass.
4) We cannot declare abstract static methods.
5) We cannot create abstract constructors.
abstract class:
•A class which is declared with “abstract” keyword is called an abstract class. Syntax is as follows:
abstract class ClassName
{
members;
}
•An abstract class can contain both concrete methods(methods which have body) and abstract methods (with no body).
•We cannot create an object for an abstract class. There is no meaning in creating objects as the class in not fully defined.
•All the abstract methods in the abstract class must be overriden in the subclass which extends this abstract superclass.
No comments:
Post a Comment