Abstract class is class and you can create simple with keyword abstract and class name. Such as-

Abstract class abc{

//You can define all methods here


You can’t create directly object or instantiate of abstract class because this will generate fatal error.

Abstract class is a OPPs (object oriented programming) feature of php.

Abstract class provides you a benefits like security, well structured code.

Abstract class can extend by extents keyword to other child class.

One more thing if you are create a abstract method in abstract class then you don’t need to define a body of this method you can declare only. Abstract method can be defined in subclass. In abstract class you can create all types of methods but if you are creating abstract method you can declare only. Such as

Abstract class father {

function abc(){

return “hello simple function”;


Abstract function xyz();


class son extends father{

public function xyz(){

       ruturn “Hello abstract you have defined”;



$obj = new son;


It is not necessary to declare all methods abstract in abstract class.

We cannot create abstract constructor or abstract static method.

If you are extending any abstract class and there is declared any abstract method then you must defined in subclass.

News Reporter
IT Software and web development, Core PHP, JavaScript, JQuery, HTML, CSS, CakePHP, Angularjs, Codeigniter etc.

Leave a Reply

Your email address will not be published. Required fields are marked *