Skip to content

Instantly share code, notes, and snippets.

@pavanBS

pavanBS/cars.php Secret

Last active Sep 26, 2018
Embed
What would you like to do?
<?php
abstract class Cars {
public abstract function getCompanyName();
public abstract function getPrice();
}
class Baleno extends Cars {
public function getCompanyName() {
return "Maruthi Suzuki" . '<br/>';
}
public function getPrice() {
return 720000 . '<br/>';
}
}
class Santro extends Cars {
public function getCompanyName() {
return "Hyundai" . '<br/>';
}
public function getPrice() {
return 300000 . '<br/>';
}
}
$car = new Baleno();
$car1 = new Santro();
echo $car->getCompanyName();
echo $car->getPrice();
echo $car1->getCompanyName();
echo $car1->getPrice();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.