Table of Contents

JObject

API Package Subpackage Class Method Reference Last reviewed Doc status
API Home Package Joomla.Framework Subpackage Base Class JObject Method JObject Reference JObject() Never Work in Progress

This function is a hack to support the PHP5 __construct() on PHP4.

Descendant classes have no PHP4 class_name() constructors. If the code runs in PHP4 this constructor gets called first and calls the __construct() of the inherited class which (if present) should call parent::__construct().

Syntax

JObject JObject ()

Examples

This example declares the class MyObject which inherits from JObject implementing the PHP5 constructor __contruct() only.

Example

class MyObject extends JObject 
{
    var $title;

    function __construct($title) {
        $this->title = $title;
    }
}

$obj = new MyObject('New Title');

The calling chain in PHP4 would result in:

1.) JObject::JObject()
2.) %%MyObject::__construct()%%

whereas in PHP5 the result is:

1.) %%MyObject __construct()%%

See also PHP manual: