Accessibility of members
Do C # should all understand. Don't explain it.
Static Class
1. Static classes must derive directly from the base class System.Object, and derive no meaning from any other base class. Inheritance applies only to objects, and you cannot create instances of static classes 2. Static classes cannot implement any interface, because only one instance of the class can be used to invoke the class's interface method 3. Static classes can only define static members (fields, methods, properties, and events). Any instance member will cause the compiler to error 4. Static classes cannot be used as fields, method parameters, or local variables because they represent variables that refer to an instance, which is not allowed. The compiler detects that any such usage will be an error.
The book is easy to say.
Probably said a bit.
Static classes cannot be instantiated, cannot be inherited, and so on.
1. First, the static class is a constraint in which all the methods and fields must be static fields.
2. Static methods are classes that are called by classes, and instance methods are objects that are called by objects.
A static method or field cannot be called after the instantiation.
So he can record some kind of information.
3. Static types are recycled only after the internal process has ended, so you can also do some caching
Partial
Public Partial class partialtest{ publicvoid test1 () {}}publicpartial Class partialtest{ publicvoid test2 () {}}var New partialtest (); O1.test1 (); O1.test2 ();
The above code is simple enough to explain the problem
Scenario Usage
- Source Code Control
- Decompose a class or struct into different logical units in the same file
- Code splitting
It's a kind of grammatical sugar. What the compiler does.
Component, polymorphism, and version control
Sealed classes, virtual methods, abstract classes, including interfaces that are not spoken here.
In general, it is the foundation of class design.
Design the structure from the aspects of business, performance, security, maintainability and so on.
This chapter is to lay the groundwork. Here is the only word about grammar, more understanding of design patterns, will be in the future to fill the pit.
06 Types and Member Bases