NET Basics Review (1)

Source: Internet
Author: User

the difference between 1.1 override and overloadOverride (override)
1, method name, parameter, return value is the same.
2. The subclass method cannot reduce the access rights of the parent class method.
3. The subclass method cannot throw more exceptions than the parent class method (but the subclass method can not throw an exception).
4, exists between the parent class and the child class.
5. The method is defined as final and cannot be overridden.
overload (Heavy duty)
1, the parameter type, number, order at least one is not the same.
2. You cannot overload a method name that has only a different return value.
3, exists in the parent class and subclass, in the same class. 1.2 Benefits to an object

Using object-oriented thinking for development has the following advantages:
1. Easy Maintenance
Object-oriented design of the structure, high readability, due to the existence of inheritance, even if the need to change, then maintenance is only in the local module, so maintenance is very convenient and low cost.
2. High quality
At design time, you can reuse existing classes that have been tested in the field of previous projects to make the system meet business requirements and have high quality.
3. High efficiency
In software development, according to the needs of the design of the real world of things to abstract, produce classes. Using this method to solve the problem, close to the daily life and the natural way of thinking, is bound to improve the efficiency and quality of software development.
4. Easy to expand
Due to the characteristics of inheritance, encapsulation and polymorphism, the system structure of high cohesion and low coupling is designed naturally, which makes the system more flexible, easier to expand and less cost.

1.3 Principles of object-oriented design

SRP Single Duty principle
As far as a class is concerned, there should be only one cause for it to change.

OCP Open ———— Closure principle
Software entities (classes, modules, functions, etc.) should be available, but not modifiable.
LSP Liskov Substitution principle

Subtypes must be able to replace their parent types.

DIP Dependency Inversion principle
Abstraction should not depend on detail. The details should depend on abstraction.
ISP Interface Isolation principle
Customers should not be forced to rely on methods that they do not use. The interface belongs to the customer and does not belong to the class hierarchy in which it resides.
REP Reuse Publishing Equivalence principle
The granularity of reuse is the granularity of the release
CCP Common closure principle
All classes in the package should be closed together for changes of the same class nature. If a change affects a package, it will affect all classes in the package, but not the other packages.
CRP Common Reuse principle
All classes in a package should be reused together. If one of the classes in the package is reused, then all classes in the package must be reused.
ADP non-cyclic reliance principle
The ring is not allowed in the dependency diagram of the package.
SDP Stability Dependency principle
To rely on in a stable direction
SAP Stability Abstraction principle
The degree of abstraction of a package should be consistent with its degree of stability.

NET Basics Review (1)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.