The variables created by the class are called objects.
Object oriented thinking: Teach us how to use the rules of a class to write code properly
Three main features: encapsulation, inheritance, polymorphism
Class:
You can define member variables, fields
method, two identical ranges (in the same class, or parent-child class) two with the same name but different parameter types or different number of parameters to form an overloaded relationship between each other
Static members: Without initialization of objects, all object shares are called directly through the class name
Common methods in the same class can call each other
A field of a class can be called directly by an instance method of a class
A static method of a class can only access static fields directly
Encapsulation: The member variable is set to private, and then a property is encapsulated
property is a read writer with get and set two functions, capable of data passing for member assignment values
Inheritance: A class can have an inheritance relationship with a class, but a class can inherit only one parent class, but many
Class inheritance
Modifiers for the class:
Public: Cross assemblies, namespaces, must have a using reference
Internal: Default, own current namespace scope
Modifier for Member:
Private: Only the current class
Protected: Protected, current class and subclass
Public: Common, cross-assembly
Internal: The current namespace, but as the scope of the class depends, when we set the class to public,
Then the members of the internal can also be accessed in other namespaces
Inheritance: The relationship between classes and classes: parent-child relationships
Subclass inherits Parent class, a class can inherit only one parent class
When a subclass inherits the parent class, it has the public properties and methods of the parent class
A subclass object can be converted directly to a parent class type, but the parent object cannot be converted directly to a subclass type when a parent class object
The properties and methods of a subclass cannot be ordered by the parent class type when it is converted through a subclass object
Only when the parent class object is converted from a subclass object can it be converted back
An equality assignment for an object that is actually assigned a pointer to the
Class1 C = new Class1 ();
Class1 d = c; Then D and C are a thing.
When a subclass inherits from a parent class, the Applies class in the parent class has a method of the same name with different parameters, which can be overloaded with the subclass method
The parent class can only tune its own method, not the tone class,
When a parent class has a method with the same name as the child class, the parent class's method is modulated by the parent class type object.
The method of subclasses is adjusted by subclass type
Abstract class: Cannot instantiate its own object
Abstract classes have abstract methods, abstract methods must be implemented in subclasses, overriding the abstract method through override must be in an abstract class, but abstract methods are not necessarily abstract, abstract properties must be overridden
Interface: In order to express attribution to multiple classifications, a class can inherit only one parent class, but can inherit multiple interfaces in order to implement the case where multiple classes can inherit
C # Object-oriented