summaryrefslogtreecommitdiff
path: root/include/class.h
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-04-02 23:21:16 +0200
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-04-02 23:21:16 +0200
commit2e4318b5ecae22b6bc0f04dfc116ff3e4647b1e8 (patch)
treed93a7d146fb0555b45e70780ac69f6df6dedcc3a /include/class.h
parenta3bd6dc04d5210ddeffdda5884f51c0e5b37ec27 (diff)
it now is possible to register a class as base class (although not yet working) (request from issue #52)
Diffstat (limited to 'include/class.h')
-rw-r--r--include/class.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/include/class.h b/include/class.h
index 8c78069..7b9a928 100644
--- a/include/class.h
+++ b/include/class.h
@@ -197,13 +197,13 @@ public:
*
* The base class that you supply must already be registered. And because
* your extension is most likely registered before any user space PHP scripts
- * run, you can only specify built-in classes, or classes that you created
- * in your own extension.
+ * run, you can only specify classes that you created in your own extension.
*
- * @param name Name of the base class
+ * @param base Php::Class object
* @return Class Same object to allow chaining
*/
-// Class<T> &extends(const char *name) { ClassBase::extends(name); return *this; }
+ template<typename CLASS>
+ Class<T> &extends(const Class<CLASS> &base) { ClassBase::extends(base); return *this; }
private:
/**
@@ -534,9 +534,17 @@ private:
}
/**
- * Namespaces have access to the private base class
+ * Namespaces have access to the private base class, so that the classes
+ * can be registered.
*/
friend class Namespace;
+
+ /**
+ * All Php::Class<AnyThing> also need access to the base class to
+ * register this class as base class.
+ */
+ template<typename ANYTHING> friend class Class;
+
};
/**