Encapsulation (relationships public, protected, private) of

Namely: public (open) private (proprietary) protectde (protected)

 Did not add any access is by default public, anywhere can access

 

 

private protected public
A class
Subclass of  
All external members    

There is the default constructor method (constructor not set to private)

public disclosure

 

class the Person {
     // Here is the man of the member attribute 
    var $ name; // person's name 
    var $ Sex; // person's gender 
    var $ Age; // person's age 
 
    // The following are members of the human method 
    function say ( ) { // this method one can speak 
        echo " person talking " ; 
    } 
 
    function RUN () { // this person can walk way 
        echo " man walking " ; 
    } 
} 
 
$ P1 = new new the person ();
 ?>

 

Guess you like

Origin www.cnblogs.com/Aleen/p/11233786.html