Tag:highlight method override target type php constants Non-static methods text sel
Public: Common properties or methods can be called by Self::var or Self::method in subclasses, and methods in the parent class can be called through Parent::method, but public properties cannot be called. In an instance, you can pass the $obj-> var or self::method to call protected: A protected type can be called through Self::var or Self::method in a subclass, and a method in the parent class can be called through Parent::method to not pass through $obj-in the instance >var to call a method or property of the protected type private: A property or method of a private type that can only be used in that class, cannot call properties and methods of private types in instances, subclasses, instances of subclasses, and then final 1. Final cannot be used to modify member properties 2.final can only be modified by class and method functions: The modified class cannot be inherited by the quilt class, and the modified method cannot be overridden by the method of the quilt class. And then say that static 1.static is used to decorate member properties and member methods, but cannot be used to decorate Class 2. Member properties that are decorated with static can be shared by all objects of the same class 3. Static data is present in the in-memory data segment (initializing static segment) 4. Static data is assigned to 5 in memory when the class is first loaded. What is a class being loaded? As long as the class is used in the program (with this class name appearing) 6. Static member properties are accessed using the class name, without creating objects, without object access, and within the class you can use self to represent this class ($this) 7. Static methods that cannot access non-static member properties (however, Non-static methods can access static member properties, non-static member properties, must be accessed with objects, internal access to non-static member properties, with $this. 8. If you determine that a method does not need to use non-static member properties, you can declare the method as a static method, without instantiating the object, you can access the last to say Const 1. It can only be used to decorate member properties 2. Declaring a constant in a class must use Const 3. Access is the same as accessing static member properties (classes are used outside the class name:: Member property, Inside the self:: member property) 4. Constants must be given initial values at the time of declaration
PHP keyword Public Private protect final static const