Ref T709 Prevent instantiation of CXSwiftBusSettingsQtFree, to avoid slicing.

- Constructors and destructor are protected.
- Therefore destructor doesn't need to be virtual.
- objectUpdated is pure virtual, so the class is abstract.
- Both derived classes are declared final.
This commit is contained in:
Mat Sutcliffe
2019-08-12 22:39:14 +01:00
parent 8510fbe3bb
commit dbba3ccf6f
4 changed files with 11 additions and 14 deletions

View File

@@ -18,7 +18,7 @@ namespace XSwiftBus
/*!
* XSwiftBus/swift side settings class, JSON capable, shared among all services
*/
class CSettings : public BlackMisc::Simulation::Settings::CXSwiftBusSettingsQtFree
class CSettings final : public BlackMisc::Simulation::Settings::CXSwiftBusSettingsQtFree
{
public:
//! Constructor.
@@ -27,8 +27,9 @@ namespace XSwiftBus
//! JSON constructor
CSettings(const std::string &json);
//! Destructor;
virtual ~CSettings() {}
protected:
//! \copydoc CXSwiftBusSettingsQtFree::objectUpdated
virtual void objectUpdated() override final {}
};
//! Something owning the settings