Static properties, constants, cloning objects

A static properties

        Use keyword static properties and methods defined directly belong to the class, the object does not go into

        Access class static property static property class name :: 1 :: scope resolution operator before static properties plus $ 2.

        Static methods and static properties of the same attributes

        Static methods can not use the keyword $ this $ this is an instance of an object and the object can not access the static member

        Static class members operating inside the box using self self directed class itself

Second, the constant

        Class keyword, sonst defined constant member, visit the class constants, using self

        Constant object can not operate

Third, Object clone

        1, a variable assignment between the object and is not cloned, but the object will be assigned to the variable address memory

        2, js create objects cloned by

        3, php objects cloned by clone keyword

        By the time the keyword clone clone, in fact, hidden function function _clone call ()

        

 

        If the class instance object generated not to be cloned, modified to hide access modifier function function _clone () in front of it as protected

         

 

Guess you like

Origin www.cnblogs.com/dengpu/p/11358175.html