note 124405 added to language.oop5.inheritance
| From: | ragusmech35 at gmail dot com | Date: | Mon, 18 Nov 2019 05:25:09 +0000 |
| Subject: | note 124405 added to language.oop5.inheritance | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-213135@lists.php.net to get a copy of this message | ||
<!DOCTYPE html>
<html>
<body>
<?php
class Fruit {
public $name;
public $color;
public function __construct($name, $color) {
$this->name = $name;
$this->color = $color;
}
public function intro() {
echo "The fruit is {$this->name} and the color is {$this->color}.";
}
}
// Strawberry is inherited from Fruit
class Strawberry extends Fruit {
public function message() {
echo "Am I a fruit or a berry? ";
}
}
$strawberry = new Strawberry("Strawberry", "red");
$strawberry->message();
$strawberry->intro();
?>
</body>
</html>
----
Server IP: 208.43.231.9
Probable Submitter: 185.85.3.195 (proxied: 49.207.180.244)
----
Manual Page -- http://php.net/manual/en/language.oop5.inheritance.php
Edit -- https://master.php.net/note/edit/124405
Del: integrated -- https://master.php.net/note/delete/124405/integrated
Del: useless -- https://master.php.net/note/delete/124405/useless
Del: bad code -- https://master.php.net/note/delete/124405/bad+code
Del: spam -- https://master.php.net/note/delete/124405/spam
Del: non-english -- https://master.php.net/note/delete/124405/non-english
Del: in docs -- https://master.php.net/note/delete/124405/in+docs
Del: other reasons-- https://master.php.net/note/delete/124405
Reject -- https://master.php.net/note/reject/124405
Search -- https://master.php.net/manage/user-notes.php