contents = $contents;
}
function get_whats_inside(){
return $this->contents;
}
}
class ShoeBox extends Box{
var $size;
function ShoeBox($contents, $size){
$this->contents = $contents;
$this->size = $size;
}
function get_shoe_size(){
return $this->size;
}
}
$mybox = new Box("shoe");
echo $mybox->get_whats_inside();
echo '
';
$mybox = new ShoeBox("Shoes", 10);
echo $mybox->get_whats_inside();
echo $mybox->get_shoe_size();
class dispBox{
var $height = 30;
var $width = 30;
var $bcolor = '#ddd';
function dispBox(){
}
function setHeight($value){
$this->box_height = $value;
}
function setWidth($value){
$this->box_width = $value;
}
function setColor($value){
$this->box_color = $value;
}
function buildBox(){
echo sprintf('',$this->box_height,$this->box_width,$this->box_color);
}
}
$box = new dispBox();
$box->setHeight(220);
$box->setWidth(500);
$box->setColor('#fdf');
$box->buildBox();
?>