The son said: "Warm so know new, can for the teacher"
123 of the content, the directory is as follows:
Set up class person{...}
Instantiate class $p 1 = new person ();
Inheriting class children extend person{...}
In succession, it is said that you can increase your own properties and methods;
The methods of two methods are constructed by __construct and __destruct.
Private,protected,public these three levels of attributes, methods have been invoked by the restrictions;
The assignment of the private property can be realized by __construct;
On this basis, the __set ($name, $value) settings are provided, __get ($name) are obtained, and the __unset ($name) method of __isset ($name) and emptying attribute values is set;
Through the parent:: In a sense to implement overloading, for subclasses to add some of the parent class method does not exist in the function;
Final defines some classes or methods that can no longer be duplicated;
Static methods or properties, which define statically classes and properties that allow all inheritors to use the same static space, static methods can only invoke static properties in the class, static properties, methods to be called with the class Name:: Property/method;
Const defines constant const PI = "3.14"; also use class name::p I to use;
__tostring () {} If the direct echo $p 1 will be error, but in the __tostring set the return value, the output will output the set return value;
Clone and __clone () clones the instance, obtain an identical instance, can define some changes after the clone through __clone (), __clone () {$this->age = $this->age. " Hehe "};
__call () {$name, $array} When a method of a nonexistent class is called, if a predefined __call can bypass the error, continue execution, and obtain the non-existent method name and argument, the parameter is returned in an array;
10 minutes Learning php Face Object Basics (Ⅳ)