Vi. attributes and Methods
(1) attributes
1. Attribute definition: name of an object's components... Understanding how to add some characters in the game. HP, blue, and so on are attributes.
2. Method for referencing attributes: Object Name. attribute name
3. Property Code: Public string name {get {return **}; set {alue = ....};}
(2) Method
1. Method: The Implementation form of the object, for example, cutting the tool
2. method declaration modifier:
Private is used only within the class.
Public variables and Methods
Protected
Internal
In addition, it can be used in combination:
New
The void method does not return values ....
Static has a return value method, which generally requires return, which can be considered as a variable returned by return.
Virtual
Override
Sealed closed
Abstract
Extern
3. Classification of Methods: static and non-static methods
Static methods must be static and cannot be referenced using this. Non-static methods can reference this;
4. Method overloading: methods with the same name are automatically reloaded according to different parameters.
5. Main method: The program entry point is static, and the internal method cannot be shared by the outside.
C # study notes 6, attributes and methods for non-computer professionals