@@ -324,7 +324,7 @@ <h2>Static methods</h2>
324324/**
325325 * A very simple class that will be exported to PHP
326326 */
327- class PublicClass : Php::Base
327+ class PublicClass : public Php::Base
328328{
329329public:
330330 /**
@@ -380,7 +380,7 @@ <h2>Static methods</h2>
380380 myClass.method("static3", &PrivateClass::staticMethod);
381381
382382 // add the class to the extension
383- myExtension.add(std::move(counter ));
383+ myExtension.add(std::move(myClass ));
384384
385385 // In fact, because a static method has the same signature
386386 // as a regular function, you can also register static
@@ -397,7 +397,25 @@ <h2>Static methods</h2>
397397 It is questionable how useful this all is. It is probably advisable to keep
398398 your code clean, simple and maintainable, and only register static PHP methods
399399 that are also in C++ static methods of the same class. But C++ does not forbid
400- you to do it completely different.
400+ you to do it completely different. Let's round up with an example how to
401+ call the static methods
402+ </ p >
403+ < p >
404+ < pre class ="language-c++ "> < code >
405+ <?php
406+ // this will call PublicClass::staticMethod()
407+ MyClass::static1();
408+
409+ // this will call PrivateClass::staticMethod()
410+ MyClass::static2();
411+
412+ // this will call regularFunction
413+ MyClass::static3();
414+
415+ // this will call PrivateClass::staticMethod
416+ myFunction();
417+ ?>
418+ </ code > </ pre >
401419</ p>
402420< h2 > Access modifiers</ h2 >
403421< p >
0 commit comments