Practice php object-oriented, and finally the final class methods

<? PHP 

// example of the final class and final method 
// final class can not be inherited 
Final  class Tea 
{ 

} 

class Stu the extends Tea   // we have to inherit it and see 
{ 

}

After the final results of error class inheritance:

 

 

 

<? PHP 

// example of the final class and final method 
// The final method is rewritten, but you can use 
class Tea 
{ 
    Final  public  function Book () 
    { 
        
    } 
} 

class Stu the extends Tea   // we have to inherit it and see 
{
     Final  public  function Book () 
    { 
        
    } 
}

The final method after being given the inheritance results:

 

Guess you like

Origin www.cnblogs.com/xm666/p/11262158.html