Basic Java Learning--abstract classes and abstract functions
- Abstract class
- An abstract class cannot make an object, but a variable can be defined, and the object assigned to the variable must be a non-abstract subclass of it;
- Abstract functions in abstract classes have no function body, for example: public abstract void Move ();
- An abstract class can have no abstract method, and all methods have a method body, but the whole class is abstract.
- All abstract functions in an abstract class must be overridden by a subclass, rather than an abstract function. Because subclasses inherit functions from the parent class, and if you do not overwrite the inherited abstract functions, the subclasses contain abstract functions, and the classes containing the abstract functions must be declared as abstract classes.
- The design of such an abstract class is primarily to prevent the object from making it.
Basic Java Learning--abstract classes and abstract functions