ByteBrawl - Abstract - Non Access Modifiers - Encapsulation

Non Access Modifiers - Abstract

abstract

The abstract modifier can only be used on classes and methods. An abstract class cannot be instantiated directly and is meant to be subclassed. It acts like a contract for classes that extend it because those classes must implement the abstract methods. Abstract methods are allowed only in abstract classes and do not have a body. This means that the subclass must provide an implementation for these methods. We'll discuss this more in the next section, Inheritance.