diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-04-05 11:58:12 +0200 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-04-05 11:58:12 +0200 |
commit | ffdccb83d460791202bdb258dbb9106da877da3b (patch) | |
tree | d8e7e1cbfd90f05611c43fdd5e565b5438fb4765 /documentation | |
parent | d9c16ddf8f36fcd50c39a73f5a4ab242896e0a84 (diff) |
implemented static properties as requested in issue #58v1.0
Diffstat (limited to 'documentation')
-rw-r--r-- | documentation/properties.html | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/documentation/properties.html b/documentation/properties.html index 288a7e6..6f3ece5 100644 --- a/documentation/properties.html +++ b/documentation/properties.html @@ -148,11 +148,12 @@ extern "C" { properties, but even that is probably not what you want, as storing data in native C++ variables is much faster. </p> -<h2 id="constants">Class constants</h2> +<h2 id="static-constants">Static properties and class constants</h2> <p> - Class constants can be defined in a similar way as properties. The only - difference is that you have to pass in the flag 'Php::Const' instead of - one of the public, private or protected access modifiers. + Static properties and class class constants can be defined in a similar way + as properties. The only difference is that you have to pass in either the + flag 'Php::Static' or 'Php::Const' instead of one of the Php::Public, + Php::Private or Php::Protected access modifiers. </p> <p> <pre class="language-cpp"><code> @@ -179,6 +180,9 @@ extern "C" { // the Example class has a class constant example.property("MY_CONSTANT", "some value", Php::Const); + // and a public static propertie + example.property("my_property", "initial value", Php::Public | Php::Static); + // add the class to the extension myExtension.add(std::move(example)); @@ -189,7 +193,8 @@ extern "C" { </code></pre> </p> <p> - The class constant can be accessed from PHP scripts using Example::MY_CONSTANT. + The class constant can be accessed from PHP scripts using Example::MY_CONSTANT, + and the static properties with Example::$my_property. </p> <h2>Smart properties</h2> <p> |