class Cart {
var $items;
function add_item ($artnr, $num) {
$this->items[$artnr] += $num;
}
function remove_item ($artnr, $num) {
if ($this->items[$artnr] > $num) {
$this->items[$artnr] -= $num;
return true;
} else {
return false;
}
}
}
class Named_Cart extends Cart {
var $owner;
function set_owner ($name) {
$this->owner = $name;
}
}
$ncart = new Named_Cart;
$ncart->set_owner ("kris");
print $ncart->owner;
$ncart->add_item ("10", 1);
?>