This article is only for individual learning summary, errors and shortcomings welcome you to add and comments. Understanding things three steps, concept, existence meaning (design concept), concrete usage, advantages and disadvantages.
One: Basic concepts
Object: C # is an object-oriented language that considers everything to be the object.
Class: A class is an abstraction of an object. For example an abstraction (human) of an object (person).
Abstract class: A class that contains one or more abstract methods, called an abstract class.
Abstract classes can only come from the base and cannot be instantiated. Declared with an abstract. Must be implemented in subclasses.
1 Abstract classShapesclass2 3 {4 5 Abstract Public intArea ();6 7 }8 9 classSquare:shapesclassTen One { A - intx, y; - the //Not providing a area method results - - //In a compile-time error. - + Public Override intArea () - + { A at returnX *y; - - } - -}View Code
Virtual class: The VM keyword declares that the method can be overridden by telling the editor.
Sealed class: The SEALED keyword declaration tells the editor that the class cannot be inherited.
Interface: A description or contract that can be understood as a function. The main structure of the program is clear, the design of the focus on the architecture. The interface is but inherited, and the subclass must be functionally implemented. With the interface keyword declaration, the first letter convention is I.
Second: Design concept
Personal understanding, the computer network belongs to the real life of a mapping, the existence of the program is to more objective, a good description of life. For example, building buildings, first of all need a foundation, close the building around the reinforcement of cement, people access to elevators, doors and windows. Okay, here we go. The target is determined, the infrastructure is determined, the required basic functions are determined, the interface contract function, the class encapsulation implementation function is good.
Interface: It is a function description, it is a contract directly.
Multiple inheritance relationships (interfaces can inherit multiple interfaces, classes can also inherit multiple interfaces), and subclasses must implement the functions defined by the interfaces.
The introduction of the interface, can make the program architecture design process better focus on the design, rather than to the specific function to achieve waste of energy.
Class: A class is an abstraction of an object. Can be understood as a function of encapsulation.
Third: specific usage (omitted here)
Four: Advantages and disadvantages (mentioned above, here is a little ...) )
C # Basics