Abstract - Day 6 Flashcards
Abstract
An incomplete method and requires a child class to complete it.
Child class MUST implement the abstract methods.
Coding with abstract
Abstract class encapsulates the common behaviour of its children classes through abstract methods
Non abstract classes that extends an abstract class must implement abstract methods
If it contains abstract method then class is abstract
Class can be abstract without any method
Abstract classes enforce_____ and abstract methods enforce ______
Inheritance and overriding
Parent reference and child object both refer to an abstract class will always be of the child class
> > “abstract”
Why abstract?
TO INDUCT INHERITANCE
Instanceof operator
Tests whether a reference variable is an instance of the specified type (class, subclass or interface)