note 126082 added to language.oop5.abstract

From: Date: Tue, 18 May 2021 10:57:19 +0000
Subject: note 126082 added to language.oop5.abstract
Groups: php.notes 
Request: Send a blank email to php-notes+get-216390@lists.php.net to get a copy of this message
<?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(); ---- Server IP: 45.112.84.4 Probable Submitter: 45.112.85.242 (proxied: 103.25.248.244) ---- Manual Page -- https://php.net/manual/en/language.oop5.abstract.php Edit -- https://main.php.net/note/edit/126082 Del: integrated -- https://main.php.net/note/delete/126082/integrated Del: useless -- https://main.php.net/note/delete/126082/useless Del: bad code -- https://main.php.net/note/delete/126082/bad+code Del: spam -- https://main.php.net/note/delete/126082/spam Del: non-english -- https://main.php.net/note/delete/126082/non-english Del: in docs -- https://main.php.net/note/delete/126082/in+docs Del: other reasons-- https://main.php.net/note/delete/126082 Reject -- https://main.php.net/note/reject/126082 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#216390) next »