git repos / saland

commit 16a37550

Poul Sander · 2018-11-07 18:03
16a3755066706f55b91d3db6a18049a59679a0c1 patch · browse files
parent 9d0c689a7eeedc0f936dc7fc4a05ed4274659871

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();