1. Three major features
Encapsulation: hides the internal implementation.
Inheritance: Reusing existing code.
Polymorphic: Overrides object behavior.
2. Design principles
A class has only one cause that causes it to change.
The class module should be extensible, but not modifiable. (for extended development, closed for modification)
A subclass can replace its base class anywhere.
Try to use a single, functional interface without using a complex, comprehensive interface.
High-level modules should not be dependent on lower-layer modules, both of which should be dependent on abstraction. Abstractions should not be dependent on implementation details, and implementation details should be dependent on abstraction.
Requires as much encapsulation as possible to be as independent as possible, using a low-level access modifier.
If you are only trying to achieve the purpose of code reuse, use combinations and aggregations instead of inheritance.
The above is from 0 self-study c#04--characteristics and design principles of content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!