Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

what is abstract class in php with example

<?php
abstract class Cars
{
    abstract function car_details();
}
class Maruti extends Cars
{
    function car_details()
    {
        echo "Maruti Details";
    }
}
class Honda extends Cars
{
    function car_details()
    {
        echo "<br>Honda Details<br>";
    }
}

class Scoda extends Cars
{
    function car_details()
    {
        echo "<br>Scoda Details<br>";
    }
}

$obj = new Maruti();
$obj -> car_details();

$obj1 = new Honda();
$obj1 -> car_details();

$obj2 = new Scoda();
$obj2 -> car_details();
?>
Source by onecompiler.com #
 
PREVIOUS NEXT
Tagged: #abstract #class #php
ADD COMMENT
Topic
Name
7+1 =