This site is mobile accessible. Press the "Tap Here" button to use a different font-size.
Smartphone icons created by Freepik - Flaticon
W3Schools.com
<?php // define a protected Static Method class domain { protected static function getWebsiteName() { return "W3Schools.com"; } } class domainW3 extends domain { public $websiteName; public function __construct() { $this -> websiteName = parent::getWebsiteName(); } } $domainW3 = new domainW3; echo $domainW3 -> websiteName; ?>
To call a static method from a child class, use the
keyword inside the child class. Here, the static method can be or .