Skip to content

Commit 60ebc7d

Browse files
committed
trivial: Mark overrides as such.
This trivial change adds the "override" keyword to some methods of subclasses meant to override interface methods. This ensures that any future change to the interface' method signatures which are not correctly mirrored in the subclass will break at compile time with a clear error message, rather than fail at runtime (which is harder to debug).
1 parent d792e47 commit 60ebc7d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/bench/bench.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,19 @@ class Printer
111111
class ConsolePrinter : public Printer
112112
{
113113
public:
114-
void header();
115-
void result(const State& state);
116-
void footer();
114+
void header() override;
115+
void result(const State& state) override;
116+
void footer() override;
117117
};
118118

119119
// creates box plot with plotly.js
120120
class PlotlyPrinter : public Printer
121121
{
122122
public:
123123
PlotlyPrinter(std::string plotly_url, int64_t width, int64_t height);
124-
void header();
125-
void result(const State& state);
126-
void footer();
124+
void header() override;
125+
void result(const State& state) override;
126+
void footer() override;
127127

128128
private:
129129
std::string m_plotly_url;

src/test/validation_block_tests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@ struct TestSubscriber : public CValidationInterface {
2525

2626
TestSubscriber(uint256 tip) : m_expected_tip(tip) {}
2727

28-
void UpdatedBlockTip(const CBlockIndex* pindexNew, const CBlockIndex* pindexFork, bool fInitialDownload)
28+
void UpdatedBlockTip(const CBlockIndex* pindexNew, const CBlockIndex* pindexFork, bool fInitialDownload) override
2929
{
3030
BOOST_CHECK_EQUAL(m_expected_tip, pindexNew->GetBlockHash());
3131
}
3232

33-
void BlockConnected(const std::shared_ptr<const CBlock>& block, const CBlockIndex* pindex, const std::vector<CTransactionRef>& txnConflicted)
33+
void BlockConnected(const std::shared_ptr<const CBlock>& block, const CBlockIndex* pindex, const std::vector<CTransactionRef>& txnConflicted) override
3434
{
3535
BOOST_CHECK_EQUAL(m_expected_tip, block->hashPrevBlock);
3636
BOOST_CHECK_EQUAL(m_expected_tip, pindex->pprev->GetBlockHash());
3737

3838
m_expected_tip = block->GetHash();
3939
}
4040

41-
void BlockDisconnected(const std::shared_ptr<const CBlock>& block)
41+
void BlockDisconnected(const std::shared_ptr<const CBlock>& block) override
4242
{
4343
BOOST_CHECK_EQUAL(m_expected_tip, block->GetHash());
4444

0 commit comments

Comments
 (0)