The object-oriented method first makes reasonable stratification of the requirements, then constructs the relatively independent business module, finally through the integration each module, achieves the high cohesion, the low coupling effect, thus satisfies the customer request. Specifically, there are three basic characteristics: encapsulation, inheritance, and polymorphism.
Encapsulation: Abstract objective things into classes, and each class protects its own data and methods. Classes can put their own data and methods to allow only trusted classes or objects to operate, to the untrusted information hiding. C + + class is a kind of encapsulation means, the process of using class to describe objective things is encapsulation, which is essentially an abstraction of objective things ...
Inheritance can use all the functionality of an existing class without rewriting the original class, which is intended for code reuse and support polymorphism. It generally has 3 forms: implementation of inheritance, visual inheritance, interface inheritance. Where inheritance is not implemented is the ability to use the properties and methods of the base class without additional coding, visual inheritance refers to the appearance and implementation code of the subform using the parent form, and interface inheritance uses only properties and methods to implement a lag to the implementation of the subclass. The first two (class inheritance) and the latter (object combination-"interface inheritance" and "pure virtual function") Form the two methods of functional reuse. A new class created through inheritance is called a derived class or subclass, and the inherited class is called the parent class, the base class, or the superclass, and the inherited process is from general to special (specific).
Polymorphism means that the same entity has multiple forms at the same time. It is mainly embodied in the inheritance of the class, it is the parent object set is called and one or more of its value object is equal to the technology, after the assignment, the parent can be based on the current assignment of the value of the object's attributes in different ways to operate. Simply put, a pointer to the parent class type is allowed to assign a pointer to the child class type. Compile-time polymorphism is static polymorphism, which can be used to determine the form of an object at compile time.
C + +: Basic Object-oriented features