1. extends can only be inherited separately.
Public protected private attribute
_ Construct ()
_ Destruct ()
_ Get () read Private Members
_ Set ($ n, $ v) sets private members
2. Access the parent class function: (c ++ is also called the scope operator)
7
3. Reload functions with the same name as the parent class
4. abstract class abstract must be inherited and cannot be replaced by instances. abstract functions must be rewritten. As long as one function in the class is static, the class must be static.
5. Common keywords
1. When final defines a class, the class cannot be inherited and the function cannot be overloaded.
2. self is used to access attributes or methods (static or constant) in the uninstantiated class and use the method self: attribute
3. static defining static members or methods will only appear in the memory once (non-static content cannot appear in the static method)
4. const defines constants that can only be modified by modifying member attributes without adding $
6. application interface of the interface definition keyword implements reference
Interface: all are abstract methods. The abstract attribute should be a constant.
Interface Demo {}
Class T implements Demo {} can reference multiple interfaces
First inherited and then Interface class a extends root implements Demo {}
Interface D extends Demo
7. polymorphism php is a weak language, so the support is not perfect.
Instanceof test whether an instance comes from a class example: a {} $ c = new a; if ($ c instanceof)
8. When an object is passed as a parameter to a function, it does not run the constructor and is not a copy, but an object address.
9. Object Description configuration _ tostring () {content} directly echo the object
10. When an object exception handler _ call ($ name, $ value) calls a method name that does not exist, it automatically absorbs your error and displays the value of $ name and error parameter.
11. Put the object clone _ clone () in the class to clone the keyword (equivalent to the copy function of c ++)
12. automatically load function _ autoload ($ class_n ){
Include ($ class_n. 'php ');
} An inlcude () class is automatically loaded when a new class is created.