Inherited:
First, what is inheritance
Concept: The father has something, and allows inheritance , all children will have
A parent class can have more than one child class
A subclass can have only one parent class
Ii. conversion between father and son
A subclass can be converted to a parent class, which can only be converted to a previous subclass
Sub-classes cannot be converted between each other
-----------------------------------------------------------------------------
1. Access modifier:
One permission limit for cross-class access
Public: The reference namespace is free to access, with the highest access rights.
Private: It can only be accessed in the class and structure in which it is declared, with the lowest access rights.
Internal: Internal, all classes in the same assembly can be accessed, and assemblies are namespaces. (Less than a detailed example of the current use)
(When not in the same namespace: Import namespaces can work correctly; method: Instantiate + Right-click class name → Parse →using Class)
Protected: Protected, can only be accessed in his own and in his own subclasses. (Less than a detailed example of the current use)
2. Namespace = assembly
Group name for a group of classes
3. Static method
Static methods and properties are used to define them;
Non-static methods need to instantiate the object and then invoke it with the object;
Random r = new random ();//instantiation
R.next (); --How to use non-static methods
Static methods, you can instantiate the object , you can not instantiate the object, directly using the class can be point out of use;
Console.Write (); --How to use static methods
(directly with the name of the class.)
6.18 (Inherit + (four-class access modifier + assembly + static method) outline