1. Class
Definition form: Public (private) class (Class) Apple (class name)
Note: Public does not restrict access to private access limited to this class
2. Constructors
Definition form: is a special method. public class name (parameter table) {}
Function: used primarily to initialize an object when an object is created, that is, to assign an initial value to an object member variable.
is always used with the new operator in the statement of the wearing object.
2. Methods
Definition form: public void (method type defined) Send (method name) (parameter)
{
}
Note: The method can be static or non-static. Access to static methods through the class, through the tired
Instance (object) to access an instance method.
3. Properties and Fields
Property: Property provides access to the attributes of an object or class. A property is a natural extension of a field.
The syntax for accessing properties and fields is the same.
The difference between a property and a field: Unlike a field, a property does not represent a storage location. Property
Has accessors that specify statements that execute when their values are read or written.
The form of the field: private string name;
Form of property: public string Name
{
Get{retrun Name;}
Set{name=value}
}
Note: Properties do not have the ability to store data, and the data is stored in fields, so only the modified field's
Data to change the data, modifying the value of the property is not used.
C # Network application programming classes, constructors, methods, properties, and fields