C++11: override keyword

Source : http://en.cppreference.com/w/cpp/language/override
This commit is contained in:
Gaurav 2015-09-04 14:04:43 +05:30 committed by Christopher Dunn
parent 3ee15b7bcc
commit aadd0b1b63
6 changed files with 15 additions and 15 deletions

View File

@ -333,9 +333,9 @@ public:
Json::Value settings_; Json::Value settings_;
CharReaderBuilder(); CharReaderBuilder();
virtual ~CharReaderBuilder(); ~CharReaderBuilder() override;
virtual CharReader* newCharReader() const; CharReader* newCharReader() const override;
/** \return true if 'settings' are legal and consistent; /** \return true if 'settings' are legal and consistent;
* otherwise, indicate bad settings via 'invalid'. * otherwise, indicate bad settings via 'invalid'.

View File

@ -40,8 +40,8 @@ namespace Json {
class JSON_API Exception : public std::exception { class JSON_API Exception : public std::exception {
public: public:
Exception(std::string const& msg); Exception(std::string const& msg);
virtual ~Exception() throw(); ~Exception() throw() override;
virtual char const* what() const throw(); char const* what() const throw() override;
protected: protected:
std::string const msg_; std::string const msg_;
}; };

View File

@ -112,12 +112,12 @@ public:
Json::Value settings_; Json::Value settings_;
StreamWriterBuilder(); StreamWriterBuilder();
virtual ~StreamWriterBuilder(); ~StreamWriterBuilder() override;
/** /**
* \throw std::exception if something goes wrong (e.g. invalid settings) * \throw std::exception if something goes wrong (e.g. invalid settings)
*/ */
virtual StreamWriter* newStreamWriter() const; StreamWriter* newStreamWriter() const override;
/** \return true if 'settings' are legal and consistent; /** \return true if 'settings' are legal and consistent;
* otherwise, indicate bad settings via 'invalid'. * otherwise, indicate bad settings via 'invalid'.
@ -158,7 +158,7 @@ class JSON_API FastWriter : public Writer {
public: public:
FastWriter(); FastWriter();
virtual ~FastWriter() {} ~FastWriter() override {}
void enableYAMLCompatibility(); void enableYAMLCompatibility();
@ -172,7 +172,7 @@ public:
void omitEndingLineFeed(); void omitEndingLineFeed();
public: // overridden from Writer public: // overridden from Writer
virtual std::string write(const Value& root); std::string write(const Value& root) override;
private: private:
void writeValue(const Value& value); void writeValue(const Value& value);
@ -210,14 +210,14 @@ private:
class JSON_API StyledWriter : public Writer { class JSON_API StyledWriter : public Writer {
public: public:
StyledWriter(); StyledWriter();
virtual ~StyledWriter() {} ~StyledWriter() override {}
public: // overridden from Writer public: // overridden from Writer
/** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format. /** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
* \param root Value to serialize. * \param root Value to serialize.
* \return String containing the JSON document that represents the root value. * \return String containing the JSON document that represents the root value.
*/ */
virtual std::string write(const Value& root); std::string write(const Value& root) override;
private: private:
void writeValue(const Value& value); void writeValue(const Value& value);

View File

@ -1903,9 +1903,9 @@ public:
: collectComments_(collectComments) : collectComments_(collectComments)
, reader_(features) , reader_(features)
{} {}
virtual bool parse( bool parse(
char const* beginDoc, char const* endDoc, char const* beginDoc, char const* endDoc,
Value* root, std::string* errs) { Value* root, std::string* errs) override {
bool ok = reader_.parse(beginDoc, endDoc, *root, collectComments_); bool ok = reader_.parse(beginDoc, endDoc, *root, collectComments_);
if (errs) { if (errs) {
*errs = reader_.getFormattedErrorMessages(); *errs = reader_.getFormattedErrorMessages();

View File

@ -816,7 +816,7 @@ struct BuiltStyledStreamWriter : public StreamWriter
std::string const& nullSymbol, std::string const& nullSymbol,
std::string const& endingLineFeedSymbol, std::string const& endingLineFeedSymbol,
bool useSpecialFloats); bool useSpecialFloats);
virtual int write(Value const& root, std::ostream* sout); int write(Value const& root, std::ostream* sout) override;
private: private:
void writeValue(Value const& value); void writeValue(Value const& value);
void writeArrayValue(Value const& value); void writeArrayValue(Value const& value);

View File

@ -265,8 +265,8 @@ TestResult& checkStringEqual(TestResult& result,
} \ } \
\ \
public: /* overidden from TestCase */ \ public: /* overidden from TestCase */ \
virtual const char* testName() const { return #FixtureType "/" #name; } \ const char* testName() const override { return #FixtureType "/" #name; } \
virtual void runTestCase(); \ void runTestCase() override; \
}; \ }; \
\ \
void Test##FixtureType##name::runTestCase() void Test##FixtureType##name::runTestCase()