日期:2014-05-17 浏览次数:20389 次
abstract class AbstractClass{ public function trip(){ $this->bookTrip(); $this->vegetablesTrip(); $this->shoesTrip(); $this->digitalTrip(); } abstract protected function bookTrip(); abstract protected function vegetablesTrip(); abstract protected function shoesTrip(); abstract protected function digitalTrip(); }
class ConcreteClass extends AbstractClass{ protected function bookTrip(){ echo "买<<丰乳肥臀>>\n"; } protected function vegetablesTrip(){ echo "买10个橘子\n"; } protected function shoesTrip(){ echo "买阿迪王\n"; } protected function digitalTrip(){ echo "没钱没手机\n"; } }
$instance=new ConcreteClass(); $instance->trip();