summaryrefslogtreecommitdiffstats
path: root/labb4/test-rule-of-three/main.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'labb4/test-rule-of-three/main.hpp')
-rw-r--r--labb4/test-rule-of-three/main.hpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/labb4/test-rule-of-three/main.hpp b/labb4/test-rule-of-three/main.hpp
new file mode 100644
index 0000000..5cd7ffb
--- /dev/null
+++ b/labb4/test-rule-of-three/main.hpp
@@ -0,0 +1,31 @@
+struct Base {
+ virtual ~Base() {}
+ virtual Base *clone() = 0;
+
+ virtual void hello() = 0;
+};
+
+struct DerivedA : public Base {
+ ~DerivedA() = default;
+ Base *clone() override;
+
+ void hello() override;
+};
+
+struct DerivedB : public Base {
+ ~DerivedB() = default;
+ Base *clone() override;
+
+ void hello() override;
+};
+
+struct GameState {
+ GameState();
+
+ GameState(const GameState &other);
+ GameState &operator=(const GameState &other);
+ ~GameState();
+
+ Base *thing;
+ void switchThing();
+};