@@ -324,7 +324,7 @@ <h2>Static methods</h2>
324
324
/**
325
325
* A very simple class that will be exported to PHP
326
326
*/
327
- class PublicClass : Php::Base
327
+ class PublicClass : public Php::Base
328
328
{
329
329
public:
330
330
/**
@@ -380,7 +380,7 @@ <h2>Static methods</h2>
380
380
myClass.method("static3", &PrivateClass::staticMethod);
381
381
382
382
// add the class to the extension
383
- myExtension.add(std::move(counter ));
383
+ myExtension.add(std::move(myClass ));
384
384
385
385
// In fact, because a static method has the same signature
386
386
// as a regular function, you can also register static
@@ -397,7 +397,25 @@ <h2>Static methods</h2>
397
397
It is questionable how useful this all is. It is probably advisable to keep
398
398
your code clean, simple and maintainable, and only register static PHP methods
399
399
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 >
401
419
</ p>
402
420
< h2 > Access modifiers</ h2 >
403
421
< p >
0 commit comments