Actions

JObject/JObject

From Joomla! Documentation

Revision as of 19:09, 18 December 2008 by Artyom (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Copyedit.png
This Article Needs Your Help

This article is tagged because it NEEDS REVIEW. You can help the Joomla! Documentation Wiki by contributing to it.
More pages that need help similar to this one are here. NOTE-If you feel the need is satistified, please remove this notice.


A hack to support __construct() on PHP 4.

In PHP 5 a method becomes a constructor when it has name "__construct". In PHP 4 constructors have the same name as the class. But it will be convenient to name constructors in the same way independently of PHP version.

This method is a hack to support __construct() on PHP 4. It works because it has the same name as the class. Also it will be invoked when a child class has no constructor. When invoked it calls method $this->__construct() and pass its arguments to it. So you can use JObject as a base class for your classes and name constructors as "__construct".

See also