Welcome to O7 Services

OOPS CONCEPT

O7services > O7 blogs  > OOPS CONCEPT
oops basic concepts in php

 OOPS BASIC CONCEPTS IN PHP

Following are the OOPS basic concepts in php

 

 

  1. Class and Object
  2. Constructor
  3. Destructor
  4. Inheritance
  5. Polymorphism
  6. Abstraction
  7. Encapsulation

CLASS

A class act as blueprint from which lot of individuals object can be created.

 

 

 

 

1.Class and Object:

Class and objects are the main part of OOPS.Class is a programmer-defined data type which includes local method and local variablesObject An individual instance of the data structure defined by class.Simple Words one class contain many objects they belong it. A class act as blueprint from which lot of individuals object can be created. When the object is created they inherit a same properties and behavior although each object may have different value for certain properties.

2 Constructor :

Constructor is the key part of OOPS PHP. Constructor is a special type of function of the class which is automatically call whenever the object is created.

3 Destructor:

Destructor is work like a garbage Collector which always focus over the object whenever no needed the object it destroy automatically.

4 Inheritance:

In inheritance , we have a parent class with its own methods and properties, and child class that can use the code from the parent. By Using inheritance, we can a reusable piece of code that we write only in the parent class and child class access it.

5 Polymorphism:

Poly means “many” and morphism means property which helps to assign more than one property.

6 Abstraction:

Abstraction is a concept in which a class has methods with implementation. The idea is to have a template and let the child class that inherits the parent class implement the method.

7 Encapsulation:

Wrapping up data member and data method together into a single unit is called Encapsulation. For example encapsulation is just like enclosing into a capsule.

Summary
1 Comment
  • Mayra
    Reply
    Posted at 5:26 am, March 13, 2019

    Your website has superb content. I bookmarked the website

Post a Comment

Comment
Name
Email
Website