diff options
author | Lenny Maiorani <lenny@serenityos.org> | 2022-02-16 11:44:57 -0700 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-02-16 22:08:55 +0000 |
commit | 27c30ca06344cc686130155aad10095ad009d7d7 (patch) | |
tree | fe76f87680d22ea7c41effb6c22f314f646d6fe4 /Userland/Games/GameOfLife | |
parent | 9521f719440d3ecbb5f06dbd86ca646f14bf862b (diff) | |
download | serenity-27c30ca06344cc686130155aad10095ad009d7d7.zip |
Games: Use default constructors/destructors
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules
"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
Diffstat (limited to 'Userland/Games/GameOfLife')
-rw-r--r-- | Userland/Games/GameOfLife/Board.cpp | 5 | ||||
-rw-r--r-- | Userland/Games/GameOfLife/Board.h | 3 | ||||
-rw-r--r-- | Userland/Games/GameOfLife/Pattern.cpp | 5 | ||||
-rw-r--r-- | Userland/Games/GameOfLife/Pattern.h | 4 |
4 files changed, 6 insertions, 11 deletions
diff --git a/Userland/Games/GameOfLife/Board.cpp b/Userland/Games/GameOfLife/Board.cpp index 897f30c340..1e693809c6 100644 --- a/Userland/Games/GameOfLife/Board.cpp +++ b/Userland/Games/GameOfLife/Board.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2021, Andres Crucitti <dasc495@gmail.com> * Copyright (c) 2021, Linus Groh <linusg@serenityos.org> + * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -14,10 +15,6 @@ Board::Board(size_t rows, size_t columns) resize(rows, columns); } -Board::~Board() -{ -} - void Board::run_generation() { m_stalled = true; diff --git a/Userland/Games/GameOfLife/Board.h b/Userland/Games/GameOfLife/Board.h index bcd3425e99..227311c1bb 100644 --- a/Userland/Games/GameOfLife/Board.h +++ b/Userland/Games/GameOfLife/Board.h @@ -1,6 +1,7 @@ /* * Copyright (c) 2021, Andres Crucitti <dasc495@gmail.com> * Copyright (c) 2021, Linus Groh <linusg@serenityos.org> + * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -14,7 +15,7 @@ class Board { public: Board(size_t rows, size_t columns); - ~Board(); + ~Board() = default; size_t columns() const { return m_columns; } size_t rows() const { return m_rows; } diff --git a/Userland/Games/GameOfLife/Pattern.cpp b/Userland/Games/GameOfLife/Pattern.cpp index 35376c6375..5c26c6dc84 100644 --- a/Userland/Games/GameOfLife/Pattern.cpp +++ b/Userland/Games/GameOfLife/Pattern.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2021, Ryan Wilson <ryan@rdwilson.xyz> + * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -16,10 +17,6 @@ Pattern::Pattern(Vector<String> pattern) m_pattern = move(pattern); } -Pattern::~Pattern() -{ -} - void Pattern::set_action(GUI::Action* action) { m_action = action; diff --git a/Userland/Games/GameOfLife/Pattern.h b/Userland/Games/GameOfLife/Pattern.h index 9fa3ce1c8b..c7b1514963 100644 --- a/Userland/Games/GameOfLife/Pattern.h +++ b/Userland/Games/GameOfLife/Pattern.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2021, Ryan Wilson <ryan@rdwilson.xyz> + * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -11,10 +12,9 @@ #include <LibGUI/Event.h> #include <LibGUI/Forward.h> -class Pattern { +class Pattern final { public: Pattern(Vector<String>); - virtual ~Pattern(); Vector<String> pattern() { return m_pattern; }; GUI::Action* action() { return m_action; } void set_action(GUI::Action*); |