Back To PHP Classes and Inheritance Index
height=10; $this->width=20; $this->depth=30; } function volume() { $vol=$this->height*$this->width*$this->depth; print('volume of box is ' . $vol); print('
'); } } class colourbox extends box { var $colour; function getdata() { $this->colour='blue'; box::bgetdata(); } function showdata() { print('colour of box is ' . $this->colour); print('
'); box::volume(); } } $ob=new colourbox; $ob->getdata(); $ob->showdata(); ?>