1. The concept and function of abstract class:
In Java, you can define a method without a method body, which is implemented by its subclasses, and the method without the method body is called an abstract method. Classes that contain abstract methods are called abstract classes.
2, the characteristics of abstract methods:
A. Only method headers, methods that have no method body are called abstract methods.
B. Abstract methods are used to modify abstractions.
C. Abstract methods represent an indeterminate method of grass operation or behavior.
D. Abstract methods cannot be called. * * can only be overridden by a quilt class.
3, the characteristics of abstract class:
A. A class that contains abstract methods in a definition is called an abstract class.
B. Abstract classes are modified with abstract,
C. An abstract class represents an abstract object type.
D. Abstract classes cannot be instantiated.
E. There can be specific methods in an abstract class, and there can be no abstract method. That is, the class containing the abstract method must be an abstract class, but abstract classes do not necessarily contain abstract methods.
4, a class to inherit the abstract class, or continue to abstract down, or write his specific implementation method.
5. Template method Model: definition: A template method defines an algorithm with some abstract operations, and subclasses redefine the specific behavior that these operations provide.
Intent: Define an algorithmic framework in an operation, defer some steps to subclasses, and template method pattern allows subclasses to redefine new algorithm steps without altering the algorithm structure.
Example: Analyze the design based on the given content:
All employees in the company have a job number, salary, and name.
The teaching director not only has all the attributes of the employee, but also the teaching allowance.
Mathematical modeling of the given analysis
Java--Abstract class