Three main features of object-oriented design: 3. encapsulation and object-oriented
Add a new assembly:
Right-click solution-add-new project-class library
Select Main project-reference-right-click to add reference
Using assembly
Class access modifier:
The class has two levels of access: public and internal.
Classes marked as Public can be accessed by any assembly in the system;
The class marked as internal can only be seen by the class in its own assembly. The default value is internal access level.
Access modifier of members
1. All explicitly declared members in the class declaration are mutually visible, regardless of their accessibility instructions
2. You must specify the access level for each member. If the access level of a Member is not specified, its implicit access level is private.
3. A member cannot have higher access than its class.
Private-it can only be accessed by members of its own class.
Internal-visible to all classes inside the Assembly, but invisible to classes outside the Assembly
Protected-allows the class of the derived class to access this Member, even if the class that inherits this class from outside the Assembly can access this member.
Protected internal-visible to all classes that inherit the class and the classes inside all the Assembly
Public-classes inside and outside the Assembly can be accessed