note 126082 deleted from language.oop5.abstract by cmb

From: Date: Tue, 18 May 2021 11:52:03 +0000
Subject: note 126082 deleted from language.oop5.abstract by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-216392@lists.php.net to get a copy of this message
Note Submitter: shewa12kpi at gmail dot com ---- <?php //Here is an example of the abstract class. Static method can be accessed without instantiate and help to do some task and another asbtract method that is resolve from the extended class Abstract class BaseEmployee { /** * some task that could be done from abstract class */ public static function intro($n,$s) { return "My name $n and salary is $s"; } /** * asbtract method that a child class must have to define */ abstract protected static function task(); } class WebDeveloper extends BaseEmployee { static function task() { return ' Develop web application'; } } class HR extends BaseEmp { static function task() { return ' Manage human resources'; } } echo WebDeveloper::intro('John',200000); echo WebDeveloper::task(); echo "<br>"; echo HR::intro('Doe',200000); echo HR::task();

« previous php.notes (#216392) next »