Help with OOPHP

From: Date: Thu, 01 Nov 2007 04:48:49 +0000
Subject: Help with OOPHP
Groups: php.general 
Request: Send a blank email to php-general+get-263905@lists.php.net to get a copy of this message
I'm hoping you guys can help me out. I'm not sure if you can do this, but i'm trying to create a class that is build of another class. I also want to be able to do functions on the class1 from within class2. example: class fruitBasket{ private $fuit = array(); //this is a class public function addFruit($newFruit) { $this->fruitBasket[] = $newFruit(); } public makeAllApples() { foreach($this->fruit AS $value) { $value->changeName("apple"); } } } class fruit{ private $name; public __construct($name) { $this->name = $name; } public changeName($newName) { $this->name = $newName; } }

« previous php.general (#263905) next »