The double-colon operator, the scope-scoped operator, scope Resolution operator can access properties and methods overridden in static, const, and class.
Used outside of the class definition, called with the class name. In PHP 5.3.0, you can use variables instead of class names.
Program List: Accessing the class definition externally with a variable
Program List: Used outside the class definition::
Program Run Result:
Fruit Color Red
Program List: Calling the parent method
Showcolor ();? >
Program Run Result:
Fruit::showcolor () Apple::showcolor ()
Program List: Using scope qualifiers
color; } } Class Banana {public $color; Public function __construct () { $this->color = ' Banana is yellow '; } Public Function GetColor () { return apple::showcolor (); } } $banana = new Banana; echo $banana->getcolor ();? >
Program Run Result:
Banana is yellow
Program List: Methods for calling base classes
Program Run Result:
Show Color
http://www.bkjia.com/PHPjc/752410.html www.bkjia.com true http://www.bkjia.com/PHPjc/752410.html techarticle the double-colon operator, the scope-scoped operator, scope Resolution operator can access properties and methods overridden in static, const, and class. Used outside of the class definition, called with the class name. ...