Run »
×
Change Orientation
name = $name; } abstract public function intro() : string; } // Child classes class Audi extends Car { public function intro() : string { return "Choose German quality! I'm an $this->name!"; } } class Volvo extends Car { public function intro() : string { return "Proud to be Swedish! I'm a $this->name!"; } } class Citroen extends Car { public function intro() : string { return "French extravagance! I'm a $this->name!"; } } // Create objects from the child classes $audi = new audi("Audi"); echo $audi->intro(); echo "
"; $volvo = new volvo("Volvo"); echo $volvo->intro(); echo "
"; $citroen = new citroen("Citroen"); echo $citroen->intro(); ?>
×
Report a Problem:
Your E-mail:
Page address:
Description:
Submit