aboutsummaryrefslogtreecommitdiff
path: root/cc/key_manager.h
diff options
context:
space:
mode:
authorThomas Holenstein <tholenst@google.com>2018-09-25 04:40:18 -0700
committerTink Team <noreply@google.com>2018-09-25 15:01:35 -0700
commit76d1f101ce944baab92785a6ff36ca93fa322865 (patch)
treee0f01da43c220f4aca32bf514e34a7825d86b7aa /cc/key_manager.h
parent57616aaeca8a8005720cb36b43d4976c0a2ac417 (diff)
downloadtink-76d1f101ce944baab92785a6ff36ca93fa322865.tar.gz
Implement EcdsaPrivateKeyFactory based on KeyFactoryBase<>.
This requires to change the inheritance from KeyFactory to virtual. The class diagram will look as follows: KeyFactory / \ * / \ * / \ PrivateKeyFactory KeyFactoryBase \ / \ / \ / EcdsaPrivateKeyFactory In order to achieve this, and not make C++ think that the class 'KeyFactory' should be treated as separate base classes, we need to mark the inheritance marked * in the above diagram as "virtual". Virtual inheritance is allowed in C++ (though people don't like it because shows a complicated class hierarchy). There are also plenty of examples: http://cs/?q=%22+public+virtual%22 PiperOrigin-RevId: 214419799 GitOrigin-RevId: a071bc720a06cadddc23302d29fb7b59b76bd2c9
Diffstat (limited to 'cc/key_manager.h')
-rw-r--r--cc/key_manager.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/cc/key_manager.h b/cc/key_manager.h
index 0b49a455c..4b2b1ce6f 100644
--- a/cc/key_manager.h
+++ b/cc/key_manager.h
@@ -54,7 +54,7 @@ class KeyFactory {
virtual ~KeyFactory() {}
};
-class PrivateKeyFactory : public KeyFactory {
+class PrivateKeyFactory : public virtual KeyFactory {
public:
// Returns public key data extracted from the given serialized_private_key.
virtual