Object-oriented general learning
1. Encapsulation, inheritance, polymorphism
Fields: Store data, access modifiers should be set to private
Properties: Securing fields, qualifying the values and assignments of fields
New keyword:
1. Open space in the heap (the value of the reference type is in the heap)
2. Create objects in the open space
3. Call the constructor of the object (the constructor has no return value)
This keyword:
1. Object representing the current class
2. Call your own constructor
Constructors: Initializing an object (the process of assigning a value to each property of an object is called an initialization of the object), the constructor is called when the object is created
How to protect a field
1. Get ()
2. Set ()
3. Constructor function
Inherit Learning
Solve the code sink redundancy, achieve polymorphism, increase the code extensibility, easy to maintain
1, single-sex (a class can have only one parent class)
2, Transmission of
The subclass does not inherit the constructor of the parent class, but instead calls the parent class's parameterless constructor by default
C # Basic Learning (0630) object-oriented general study