DEV Community

Ak
Ak

Posted on

keyword definitions of oops(php)

Class - A class is a user defined data type which has methods and properties.
Object - A object is a instance of a class, Once we define a class we can make many objects or instances.
Methods - A function inside a class is called as methods
Properties - A variable inside a class is called as properties or also called as member variables.
Inheritance - The process of inheriting properties and methods from a base class or parent class is called Inheritance. The class that has inherited all the methods and properties is called as child class or derived class.
Constructor - Special type of function which is automatically called whenever object is formed.

Destructor - Special type of function which is automatically called whenever object is formed. The constructor and destructor are also called as magic methods.
Private - A private member can be used only inside a class in which it has been declared. Private members cannot be used inside the inherited classes.
Protected - Protected members can be used inside the same class and class that inherits the parent class.
Constant - The constants are immutable , once it is declared it cannot be changed. It is declared using a keyword const.
Abstract classes - These classes cannot be instantiated instead it can be inherited.
$this - To access a property inside a class $this keyword is used.
Static - Static methods and properties can be accessed without instantiating a class
:: - It is scope resolution operator used to access the static , constant and overridden properties and methods of a class

Top comments (0)