1. Basic relationships between classes
(1) Inheritance
① has an inheritance relationship between classes that are broken down from existing classes and the original classes (IS-A)
② inherited classes (subclasses) have all the properties and behaviors of the original class (The parent Class)
(2) Combination
① the existence of some classes must depend on other classes, a relationship called a combination
The class of a ② group is made up of other classes on a certain part .
2. representation of Classes
Notation for the "programming Experiment" class
#include <stdio.h>structbiology{BOOLLiving//Life};structanimal:biology{BOOLmovable;//can be moved voidFindfood () {};//Find Food};structplant:biology{BOOLgrowable;//can grow};structbeast:animal{voidSleep () {};//Sleep};structhuman:animal{voidSleep () {};//Sleep voidWork () {};//Labor};intMain () {return 0;}
3. Summary
(1) There can be an inheritance or composition relationship between classes
(2) Inheritance relations The Neutron class has all the properties and behaviors of the parent class
(3) A combinatorial relationship is the relationship between the whole and the part of a class
(4) The relationship between classes and classes can be represented in different ways
(5) The compiler has specific requirements for the representation of the class
14th class Advanced Object oriented (bottom)