From 1f1a0fa9349d37e623ae763b48c7ea21681cd45b Mon Sep 17 00:00:00 2001
From: Emiel Bruijntjes
- Although you may think that the magic methods are virtual methods that - are overridden from the Php::Base class, they are not. The methods are + Although you may have expected that the magic methods are virtual methods in + the Php::Base class that can be overridden, they are not. The methods are detected by the C++ compiler at compile time - and are very normal methods that just happen to have a certain name.
@@ -46,18 +46,18 @@ The only exception to this rule is the __construct() method. This method does have to be explicitly registered. There are a number of reasons for this. For a start, the __construct() method does not have a fixed signature, and - by explicitly adding it to the extension, you can also exactly specify what - parameters it accepts, and whether the __construct() method should be + by explicitly adding it to the extension, you can also specify what + parameters it accepts, and whether the __construct() method should be public, private or protected (if you want to create classes that can not be instantiated from PHP).The other reason why you have to explicitly register the __construct() method, - is that, unlike other magic methods, the magic __construct method must + is that, unlike other magic methods, the __construct method must be visible from PHP. Inside constructors of derived classes, it often is necessary to make a call to parent::__construct(). By registering the __construct() method in the get_module() function you make the function - visible from PHP, which makes constructs like this possible. + visible from PHP.
We have a special article about @@ -72,12 +72,12 @@ the object gets destructed (and the C++ destructor runs).
- The __clone() and __destruct() methods are regular magic methods. You do - not have to register them to make them active. The PHP-CPP library calls - them automatically if they are available. + The __clone() and __destruct() methods are regular magic methods and you + therefore do not have to register them to make them active. The PHP-CPP + library calls them automatically if they are available.
- In normal circumstances you probably do not need these methods very often. + In normal circumstances you probably have not need for these methods. The C++ copy constructor and the C++ destructor can be used too. The only difference is that the magic methods are called on objects that are in a fully initialized state, while the C++ copy constructor and C++ destructor @@ -85,8 +85,8 @@ being destructed.
- The article about mentioned above - as more details and examples. + The article about mentioned above about + constructors and destructors has more details and examples.
-- cgit v1.2.3