Answers for "abstract function php"

PHP
1

abstract class in php

<?php
/**
 * abstract means incomplete
 * abstract class contains atleast 1 abstract function
 * abstract function:- we must declare it but not implement it, it can not contain body
 * you can't create object of abstract method
 * abstract class, child class must contain abstract function
 */
abstract class Bank
{
    abstract function id_proof();
}
class Hdfc extends Bank
{
    function id_proof()
    {
        echo "hdfc bank";
    }
}
class Axis extends Bank
{
    function id_proof()
    {
        echo "<br>axis bank<br>";
    }
}

$obj = new Axis();
$obj -> id_proof();

$obj1 = new Hdfc();
$obj1 -> id_proof();
?>
Posted by: Guest on October-05-2021
4

abstract function php

abstract class absclass { // mark the entire class abstract
    abstract public function fuc();
}
Posted by: Guest on June-06-2021

Code answers related to "abstract function php"

Browse Popular Code Answers by Language