In the subclass, the parent: method () is used to access the methods in the parent class, but: is used to access static things. If this method is not static, isn't that self-contradictory? Why can I access it? In the subclass, the parent: method () is used to access the methods in the parent class, but: is used to access static things. If this method is not static, isn't that self-contradictory? Why can I access it?
Reply content:
In the subclass, the parent: method () is used to access the methods in the parent class, but: is used to access static things. If this method is not static, isn't that self-contradictory? Why can I access it?
You can use classname: methodname () to directly call common methods in the class at any location of the PHP file. I personally think this is because
The objects stored in the heap area of the memory only store the object attributes. The object methods are stored in the code area and are member methods of the class, if $ this is not included in the member method of the class called by the object, there is no obvious difference between this method and the static method stored in the static data area. In this case, the object's member method is not significantly different from the object's static method.
Does not change with the calling object.
In addition, the member methods are defined in the class, that is, the relationship between father and son. The difference is that they are born by their wives (static methods ), the other is born with another wife (member method). The son of another wife is called Dad. The private son knows the situation one day (no $ this ). The two will be called Dad.
Now you can use classname: methodname ()
Copy C ++.