1<?php
2/**
3 * abstract means incomplete
4 * abstract class contains atleast 1 abstract function
5 * abstract function:- we must declare it but not implement it, it can not contain body
6 * you can't create object of abstract method
7 * abstract class, child class must contain abstract function
8 */
9abstract class Bank
10{
11 abstract function id_proof();
12}
13class Hdfc extends Bank
14{
15 function id_proof()
16 {
17 echo "hdfc bank";
18 }
19}
20class Axis extends Bank
21{
22 function id_proof()
23 {
24 echo "<br>axis bank<br>";
25 }
26}
27
28$obj = new Axis();
29$obj -> id_proof();
30
31$obj1 = new Hdfc();
32$obj1 -> id_proof();
33?>
1abstract class absclass { // mark the entire class abstract
2 abstract public function fuc();
3}
1Answer
2 https://stackoverflow.com/questions/41611058/why-does-php-allow-abstract-static-functions/41611876
1abstract class Hello {
2 const CONSTANT_1 = 'abstract'; // Make Abstract
3 const CONSTANT_2 = 'abstract'; // Make Abstract
4 const CONSTANT_3 = 'Hello World'; // Normal Constant
5 function __construct() {
6 Enforcer::__add(__CLASS__, get_called_class());
7 }
8}
1
2 <?php
3abstract class
4 ParentClass {
5 abstract public function someMethod1();
6
7 abstract public function someMethod2($name, $color);
8 abstract
9 public function someMethod3() : string;
10}
11?>
12