Category : abstract-class

I am reimplementing QSqlQueryModel to represent a single table in my Database. The reimplementation below works – I inherit QSqlQueryModel, override necessary methods like roleNames() and data() and provide COLUMN_NAMES[] and SQL_SELECT. This part is easy to understand: MySqlModel.h class MySqlModel : public QSqlQueryModel { Q_OBJECT public: explicit MySqlModel(QObject* parent = Q_NULLPTR); void refresh(); QHash<int, ..

Read more

I have the following abstract class struct Interface { virtual ~Interface() = default; virtual void Do() = 0; }; And I have one or more concrete class which implements Interface struct ImplA final: Interface{ virtual void Do() override {printf("DO IN ImplAn");} }; struct ImplB final: Interface{ virtual void Do() override {printf("DO IN ImplBn");} }; Here ..

Read more

I would like to curry a function that takes an abstract argument. This makes my compiler angry: #include <functional> class MyAbstractParentClass { public: virtual void someVirtualMethod() = 0; }; class MyConcreteChildClass: public MyAbstractParentClass { public: virtual void someVirtualMethod() override {} }; void myFunction(const MyAbstractParentClass& myAbstractObject) {} int main(int argc, const char * argv[]) { const ..

Read more

I have project with different dlls. In the first dll, I have this abstract class: File: serializable.hpp (Json.dll) namespace Json { class Serializable { public: JSON_API virtual void FromJson(const char* json); JSON_API virtual void FromJson(const JsonValue& json) = 0; JSON_API virtual std::string ToJson() const = 0; }; } With this implementation for virtual void FromJson(const ..

Read more