diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-11 16:03:55 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-11 16:03:55 +0100 |
commit | 849c1c4cd7901213e54af954646a80137ad95619 (patch) | |
tree | 5e1c47c3337b15d866da00426a5e548564f55b45 /src/base.cpp | |
parent | 75321da61984251d6f5ab97f57efb2050f4dadf2 (diff) |
implemented __invoke method
Diffstat (limited to 'src/base.cpp')
-rw-r--r-- | src/base.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/base.cpp b/src/base.cpp index 85cb85c..a5dc7b3 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -165,6 +165,25 @@ Value Base::__call(const char *method, Parameters ¶ms) } /** + * Call the class as if it was a function + * + * This method is called when a an object is used with () operators: + * $object(). You can override this method to make objects callable. + * + * @param params The parameters that were passed to the function + * @return Value The return value + */ +Value Base::__invoke(Parameters ¶ms) +{ + // throw an exception that will be caught in the ClassBase class, + // so that the default implementation of the function can be called + throw NotImplemented(); + + // unreachable code + return nullptr; +} + +/** * End namespace */ } |