Answers for "abstract class in 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
1

php abstract class static method

Answer
  https://stackoverflow.com/questions/41611058/why-does-php-allow-abstract-static-functions/41611876
Posted by: Guest on July-13-2021
0

php abstract class constant

abstract class Hello {
    const CONSTANT_1 = 'abstract'; // Make Abstract
    const CONSTANT_2 = 'abstract'; // Make Abstract
    const CONSTANT_3 = 'Hello World'; // Normal Constant
    function __construct() {
        Enforcer::__add(__CLASS__, get_called_class());
    }
}
Posted by: Guest on June-17-2020
0

PHP OOP - Abstract Classes

<?php
abstract class 
    ParentClass {
  abstract public function someMethod1();
  
    abstract public function someMethod2($name, $color);
  abstract 
    public function someMethod3() : string;
}
?>
Posted by: Guest on May-28-2021

Code answers related to "abstract class in php"

Browse Popular Code Answers by Language