ok here is the new code
<?php
class product {
protected $product_name;
protected $description;
protected $price;
public function __construct($name, $desc, $price){
echo $name;
$this->product_name = $name;
$this->description = $desc;
$this->price = $price;
return $this;
}
}
class product_config extends product {
private $storage = array();
function set_product($name, $desc, $price) {
return $this->storage[] = new product($name, $desc, $price);
}
function test(){
return $this->storage[0]->product_name;
}
function render_products(){
if (!$this->storage){
return 'There are no products in storage!';
}
else{
foreach ($this->storage as $value){
echo $value->product_name."</br>";
}
}
}
}
?>
Here is the functions being called
<? php
$insert = new product_config();
$insert->set_product('candy','tasty','9.99');
echo $insert->test();
?>
and here is the errors im getting
Warning: Missing argument 1 for product::__construct(), called in C:\Program Files\EasyPHP 2.0b1\www\testing\test_page.php on line 24 and defined in C:\Program Files\EasyPHP 2.0b1\www\testing\product_config.php on line 7
Warning: Missing argument 2 for product::__construct(), called in C:\Program Files\EasyPHP 2.0b1\www\testing\test_page.php on line 24 and defined in C:\Program Files\EasyPHP 2.0b1\www\testing\product_config.php on line 7
Warning: Missing argument 3 for product::__construct(), called in C:\Program Files\EasyPHP 2.0b1\www\testing\test_page.php on line 24 and defined in C:\Program Files\EasyPHP 2.0b1\www\testing\product_config.php on line 7
Notice: Undefined variable: name in C:\Program Files\EasyPHP 2.0b1\www\testing\product_config.php on line 8
Notice: Undefined variable: name in C:\Program Files\EasyPHP 2.0b1\www\testing\product_config.php on line 9
"However, once you fix that, you'll then have a problem unless you overwrite it in your product_config class, since you apparently do not want to supply the parameters to its constructor like you do to its parent class."
Notice: Undefined variable: desc in C:\Program Files\EasyPHP 2.0b1\www\testing\product_config.php on line 10
Notice: Undefined variable: price in C:\Program Files\EasyPHP 2.0b1\www\testing\product_config.php on line 11
It appears that my varibles arent getting passed over. I did change the constuct to 2 underscores instead of 1. Im not sure what you mean by this NogDog