CREATING CLASS IN PHP PROGRAM - Anna University Internal marks 2018


As we know Object-oriented programming (OOP) is a programming model based on the concept of objects.

Before starting OOP tutorial, it is necessary to know some key words used in php object oriented programming.
  • Class : This is a programmer defined datatype.A class can have sub classes that can inherit all or some of the characteristics of the class. 
  • Object : An individual instance of the data structure defined by a class. 
  • Member Variable : These are the variables defined inside a class.
  • Member function : These are the function defined inside a class and are used to access object data.
  • Inheritance : When a class is defined by inheriting existing function of a parent class then it is called inheritance.
  • Parent class : A class that is inherited from by another class. This is also called a base class or super class.
  • Child Class : A class that inherits from another class. This is also called a subclass or derived class.
  • Polymorphism : This is an object oriented concept where same function can be used for different purposes.
  • Overloading : Functions and operators overloaded with different implementation.
  • Data Abstraction: Hiding of background details
  • Encapsulation: Wrapping of data and functions together in a single unit
  • Constructor : Used to construct an object
  • DestructorsUsed to destruct an object

Basic PHP class syntax:

PHP class Example:

 Php Tutorial Main Page 

No comments:

Post a Comment