Basic OOP in Programming Language

OOP Stands for Object Oriented Programming. OOP is not a programming language it is just a method or technique of programming where a programmer write code using a standard way rather than procedural way. The main thing of OOP is Class & Object (Instant). So, what is Class & Object? Well, Class is a set of various method & property whereas Object is a clone or image of a Class.

Let’s start declaring a class in PHP.

Syntax:

Description of each line.

Here class is a keyword which meaning we’re creating a class.
A is a name of the class. Its a good practice to use uppercase letter at the beginning of class name but it is not mandatory.
public & function both are keyword which meaning we’re creating a public function(method).
myfunction is the name of the function which return a value Hello PHP.
All set.

Now, Let’s start creating a object (instant) of class A

Description of each line.

Here $obj_A is the object(instant) name of class A. new is a key word and A is the specific class.
After creating object of class A we just call a method myfunction of class A.
when we echo the object then its show the result.

Important Features of OOP

  1. Inheritance
  2. Polymorphism
  3. Overloading
  4. Data Abstraction
  5. Encapsulation

We will discuss about every features of OOP latter.
Happy Coding!