Abstract class in php

Object Oriented Programming

Posted on 02 May 15 by Vickey

As you know the meaning of abstract is hidden or unvisiable yes the role of abstract classes are same. abstract class can not initialized directoly or we can say that we can not create object of abstract classes. we always use abstract class as a base class and inherit in a child class. In abstract class at least one function should be abstract. we can in inherit an abstract calss in another abstract class we can create abstract class by adding abstract keyword before class keyword.

abstract class mybaseclass(){

    abstract protected function sum($a,$b){


we can declare abstract function in child class

class mychildclass extends mybaseclass(){

        protected function sum($a,$b){
      echo $sum;


If this post help you reduce time to develop, you can help me to maintain this website :)