PHP OOP Abstract class

The class declared with an abstract keyword is called an abstract class.

An abstract class has some special properties.

  1. It can not be initiated, the object of this class can not be created.
  2. it will always be inherent in other classes.
  3. It can contain abstract methods. (Methods declared with abstract keyword and do not have a body)
  4. Abstract is always implemented in the derived class.


abstract class Database{
	public $server="";

class User extends Database{

$user= new User();
echo $user->server;
echo $user->server;
© 2016 - 2022, All Rights are Reserved.