| = This is haohappy read < > | = Notes in Classes and objects Chapter | = Translation-based + personal experience | = Please do not reprint in order to avoid the unnecessary trouble that may occur, thank you | = Welcome criticism, hope and all the PHP enthusiasts to progress together! +-------------------------------------------------------------------------------+/second section--PHP5 object Model PHP5 has a single-inheritance, Restricts access to the object model that can be overloaded. The "Inheritance", which is discussed in detail later in this chapter, contains parent-child relationships between classes. In addition, PHP supports restrictive access to properties and methods. You can declare members to be private and do not allow external classes to be accessed. Finally, PHP allows a subclass to overload members from its parent class. Haohappy Note: There is no private in PHP4, only public.private is good for better encapsulation. The object model of PHP5 the object as if it were to be passed by reference, unlike any other data type. PHP does not require you to pass and return objects explicitly by reference (reference). In the end of this chapter, the object model based on the handle is elaborated in detail. It is the most important new feature in PHP5. With a more straightforward object model, a handle-based architecture has additional advantages: increased efficiency, low memory footprint, and greater flexibility. In the first few versions of PHP, the script replicates the object by default. Now PHP5 only moves the handle, requiring less time. The increase in script execution efficiency is due to the avoidance of unnecessary replication. While the object system brings complexity, it also brings the benefit of execution efficiency. At the same time, reducing replication means taking up less memory and allowing more memory for other operations, which also increases efficiency. Haohappy Note: Based on a handle, it means that two objects can point to the same piece of memory, reducing both the copy action and the memory footprint. The Zand Engine 2 offers greater flexibility. A pleasing development is the permission to refactor-a class method is executed before the object is destroyed. This is also good for using memory, allowing PHP to clearly know when there is no reference to the object and allocating the vacated memory to other uses.
http://www.bkjia.com/PHPjc/532166.html www.bkjia.com true http://www.bkjia.com/PHPjc/532166.html techarticle | = Note for Haohappy read > | = Classes and objects in the Chapter | = translation + personal Experience | = To avoid unnecessary inconvenience that may occur please do not reprint, thank you | = Welcome to criticize ...