1. Static variables and methods? Use the keyword static ?, Static class methods do not need to instantiate objects. They can be called using: symbol; static methods and properties can only access static methods and properties; Use self: keywords to access static members of the current class; all instances of a class share the static attributes of the class. Static Methods call non-static methods
1. Static variables and methods? Use the keyword static ?, Static class methods do not need to instantiate objects. They can be called using: symbol; static methods and properties can only access static methods and properties; Use self: keywords to access static members of the current class; all instances of a class share the static attributes of the class. Static Methods call non-static methods
1. Static variables and methods? Use the keyword static ?, Objects do not need to be instantiated for static class methods. They are called using the: symbol;
Static methods and attributes can only access static methods and attributes;
Use self: keyword to access static members of the current class;
All instances of a class share the static attributes of the class;
When a static method calls a non-static method, the system automatically converts the method to a static method;
---- The single-piece mode in php can be implemented through static methods
2. What are the final classes and methods? ? The final class cannot be inherited, and the final method cannot be overwritten;
3. Constant? Classes use cons to modify constant names. Generally, uppercase is used, and multiple letters are separated;
4. abstract classes and abstract methods are modified using abstract,
Abstract classes cannot be instantiated;
Abstract METHODS only have method declaration, and there is no method implementation content; abstract methods are not used {}; End
In a class, the class must be an abstract class as long as there is an abstract method;
If a subclass inherits the abstract class and overwrites all the methods of the abstract class, the subclass can be instantiated;
Abstract classes inherit abstract classes. abstract methods cannot be overwritten;
---- Php template mode can be implemented through abstract classes;
Original article address: php object-oriented note (2). Thank you for sharing it.