The simplest operation is required to implement a series of complex functions, which is a technical solution. A precision instrument, a household electrical appliance, and a Xiaomi mobile phone may be used or used. They are extremely complicated internally, using a variety of accessories, using a lot of principles and knowledge. We all share the same feeling: simple, convenient, and good! In the face of complicated things, we are able to use them freely through simple introductions, and even some of them can be self-taught. Why? This uses object-oriented encapsulation.
Object-oriented encapsulation is to encapsulate complex processing in a "box". functions can be easily implemented only with a few buttons or keyboards in the shell. Oh, it turns out so.
So how is object-oriented encapsulation implemented?
Object-oriented very cleverly sets a threshold-access limiters. It is through access toggle control of external direct access to objects, so as to avoid all activities like a glass room being visible to others.
The access modifier is like the key of the door and the secret of the mobile phone. If you use it well, you can ensure security. If you do not use it well, you can lock the door independently and do not want to enter your family.
Access modifiers include private, public, protected, internal, and protected internal.
The types cannot be defined as protected, private, and protected internal, because these modifiers do not make sense for the types contained in the namespace. Therefore, these modifiers can only be applied to Members. However, you can use these modifiers to define nested types (that is, classes contained in other types, because in this case, the types also have Member States. The following code is valid:
public class OuterClass { protected class InnerClass { //etc. } // etc.}
If a nested type exists, the internal type can always access all members of the external type. Therefore, in the above code, the code in innerclass can access all members of 0uterciass, or even private members of 0utclass.