Three main pillars of OOP: (1) Encapsulation (2) Inheritance (3) polymorphism
Encapsulation in C #, here is a description of static classes and properties.
Static class: A static class that cannot be instantiated, is closed, cannot derive a type from it, and does not have a constructor method.
Static classes: Because the global approach is not allowed in C #, sometimes it takes a few tool classes to implement something like mathematical computing, and static classes come in handy.
Properties and their effects: Rokai's interpretation of attributes in Java class is "property:something that holds data". In general, customers want to access the state of an object without using a method, but the designer of the class wants to hide the state of the class in the class member so that the client can access the object's state indirectly through methods. The attribute satisfies these two purposes: (1) Provide the client with simple "member variable" interface (2) and provide the designer with the data hiding of "using method to achieve" OO design.
The properties are written as follows:
1 usingSystem;2 3 classMyClass4 {5 Public intProperty ;6 Public int Property7 {8 Get{return This. property;}9 Set{ This. property =value;}Ten } One Static voidMain (string[] args) A { -MyClass Object =NewMyClass (); -Object.property =5; the Console.WriteLine (object.property); - } -}
C # Learning the package, inheritance, and polymorphism of the IV-bomb