note 102275 added to language.oop5.basic

From: Date: Sat, 05 Feb 2011 19:00:02 +0000
Subject: note 102275 added to language.oop5.basic
Groups: php.notes 
Request: Send a blank email to php-notes+get-176704@lists.php.net to get a copy of this message
Here's another simple example. <?php // PHP 5 // class definition class Bear { // define properties public $name; public $weight; public $age; public $sex; public $colour; // constructor public function __construct() { $this->age = 0; $this->weight = 100; } // define methods public function eat($units) { echo $this->name." is eating ".$units." units of food... "; $this->weight += $units; } public function run() { echo $this->name." is running... "; } public function kill() { echo $this->name." is killing prey... "; } public function sleep() { echo $this->name." is sleeping... "; } } // extended class definition class PolarBear extends Bear { // constructor public function __construct() { parent::__construct(); $this->colour = "white"; $this->weight = 600; } // define methods public function swim() { echo $this->name." is swimming... "; } } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 69.171.163.213 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.basic.php Edit -- https://master.php.net/note/edit/102275 Del: integrated -- https://master.php.net/note/delete/102275/integrated Del: useless -- https://master.php.net/note/delete/102275/useless Del: bad code -- https://master.php.net/note/delete/102275/bad+code Del: spam -- https://master.php.net/note/delete/102275/spam Del: non-english -- https://master.php.net/note/delete/102275/non-english Del: in docs -- https://master.php.net/note/delete/102275/in+docs Del: other reasons-- https://master.php.net/note/delete/102275 Reject -- https://master.php.net/note/reject/102275 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#176704) next »