All pastes #824279 Raw Edit

Unnamed

public php v1 · immutable
·published 2007-12-19 21:46 UTC
rendered paste body
<?php	class Box{		var $contents;				function Box($contents){			$this->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 '<hr />';		$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('<div style="height:%spx;width:%spx;background-color:%s;"></div>',$this->box_height,$this->box_width,$this->box_color);		}	}			$box = new dispBox();	$box->setHeight(220);	$box->setWidth(500);	$box->setColor('#fdf');	$box->buildBox(); ?>