Object-oriented applications (I)
Suffering from customers' changing demands"
According to customer requirements, printers of different brands have the functions of starting, shutting down, and printing, so the code will not be written here
1. Syntax features of Abstract Functions
What is an abstract function?
Only functions are defined. functions without function bodies are called abstract functions:
Absyract void fun ();
2. Syntax features of abstract classes
What is an abstract class?
Classes defined by abstract are called abstract classes;
1. abstract classes cannot generate objects;
2. If a class contains abstract functions, the class must be declared as an abstract class;
3. If there is no abstract function in a class, this class can also be declared as an abstract class.
3. Role of abstract classes
Abstract classes are born to be used as the father, and are born to be inherited. abstract classes cannot generate objects, but subclasses can
1. Abstract Functions are functions without function bodies.
2. abstract classes are defined using abstract
3. abstract classes cannot generate objects, but they can have constructors.
Abstract classes and Abstract Functions