commit 16a37550
Add assignment operator
Changed files
| M | src/MenuSystem.cpp before |
| M | src/MenuSystem.h before |
diff --git a/src/MenuSystem.cpp b/src/MenuSystem.cpp
index 0f49c97..6504bd1 100644
--- a/src/MenuSystem.cpp
+++ b/src/MenuSystem.cpp
@@ -66,6 +66,13 @@ Button::~Button() {
Button::Button(const Button& b) : action{b.action}, label{b.label}, marked{b.marked} {
}
+Button& Button::operator=(const Button& other) {
+ action = other.action;
+ label = other.label;
+ marked = other.marked;
+ return *this;
+}
+
void Button::setLabel(const std::string& text) {
label = text;
}
diff --git a/src/MenuSystem.h b/src/MenuSystem.h
index f6703af..435e7a4 100644
--- a/src/MenuSystem.h
+++ b/src/MenuSystem.h
@@ -69,6 +69,7 @@ public:
Button();
Button(const Button& b);
+ Button& operator=(const Button& x);
virtual ~Button();