Proxy: the essence of proxy is to reference functions in another class. You can sort and use functions without knowing which class it comes from, as long as the function meets the same interface.
C #Everything in is regarded as an object.
The managed language is compiled into an intermediate low-level language (CLR) After the compiledCodeOr further compile the code.
The managed language is garbage collected automatically. The garbage collection language is used to release unused memory. When variables, arrays, or objects are no longer referenced, the corresponding memory space is released back to the system.
Each control is declared as a variable and added to a container.
C #Can be declared:
Public;Can be accessed by other classes
PRIVATE:The default format is not declared and can only be accessed within the class
Protected:Access
Usually declare all class variables as private and writeGetxxx, setxxxAccess the function to set and obtain data.Encapsulation Principle, Try not to allow variables in the class to be directly accessed outside the class.
Several methods with the same name, as long as these methods have different call parameters,Implement Overloading-Polymorphism
VirtualAndOverride
If there is a method in the base class and you want to overwrite it in the derived class, you should declare the method in the base classVirtualIt means that a method with the same name and parameter ID in the derived class is called, rather than a method in the base class. Must be used in a derived classOverrideKeyword to declare this method.
|
Base Class |
Derived class |
Error? |
|
Virtual |
Override |
No, execute |
|
NoneVirtual |
Override |
Error |
|
Virtual |
NoneOverride |
Error |
|
NoneVirtual |
NoneOverride |
No, warning, execute the derived class |
When the base class method cannot be declaredVirtualThe other method to replace the method in the base class is used when the method is declared in the derived class.NewKeyword to effectively hide the methods with the same name in the base class.
For example:Public new void xxxx (){}
AbstractAbstract class
1Abstract methods must be in abstract classes.
2Abstract classes do not require abstract methods, but at least one abstract method is required.
3Abstract classes cannot be instantiated and can only generate Derived classes.
4Methods of an abstract class are all abstract methods. The class cannot be inherited or inherit other class hierarchies.
5The derived class of the interface must implement all methods of the interface.