SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 228 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"

Put simply, the __construct()
method needs to be limited to scope of the class. Sadly, we cannot guarantee this in
PHP versions prior to 5.
In our example, we use the access doctag, @access, to indicate that the constructor is
private. If we were building this class specifically for a PHP 5 or above environment,
we would be able to use access modifiers (visibility). For more information about
access modifiers, refer to http://php.net/manual/language.oop5.visibility.php.
In the declaration of the getInstance() method we make the method return a
reference and we define it as static in the doctags. This means when we use the
method we must always use the =& assignment operator, to prevent copying of
the returned object, and we must use the method in the static form SomeClass::
getInstance().
At the start of the getInstance() method we declare a new static variable. Unlike
normal variables, static variables do not die after a function or method has completed.
We use the variable as a long-term store to remember the singleton object.


Pages:
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6