warning: duplInheritedMember - The class 'SomeClass' defines member function with name 'GetObject' also defined in its parent class 'SomeInterfaceClass'
class SomeInterfaceClass { public: virtual QObject& GetObject() = 0; }; class SomeClass: public SomeInterfaceClass { public: QObject& GetObject() override { return TheObject; } private: QObject& GetObject() const { return TheObject; } mutable QObject TheObject; };
The example doesn't compile since the private GetObject() cannot return a non-const reference. When const is added, there is no FP.
GetObject()
const
Sorry about that, I missed the fact that we have a mutable object.
Log in to post a comment.
warning: duplInheritedMember - The class 'SomeClass' defines member function with name 'GetObject' also defined in its parent class 'SomeInterfaceClass'
Last edit: Steve Albright 2024-05-15
The example doesn't compile since the private
GetObject()
cannot return a non-const reference. Whenconst
is added, there is no FP.Sorry about that, I missed the fact that we have a mutable object.