You are here

drupalplanet

Quick introduction to OOP.

Submitted by paulbooker on Sun, 10/19/2014 - 13:56

an object;

.. is defined;

An ‘object’ is an instance of a ‘class’. You define a class using the code below.

class parentClass
{
//  methods (functions) and properties (variables) go in here 
}

..is instantiated;

$parentObject = new parentClass;

Optionally, you can pass variables into the class which are used by the constructor method (we'll get to this shortly ..)

$parentObject = new parentClass($var1, $var2);

..can inherit;

Pages

Subscribe to RSS - drupalplanet