[Qt-interest] inteface implementation in C++/Qt

Sean Hayes sean.t.hayes at vanderbilt.edu
Wed Feb 23 03:21:34 CET 2011


>
> Under a language like ObjectiveC I would define an Interface and simply
> state that the class implements the interface.  Is there an appropriate C++
> or Qt way of doing this?
>

The C++ way to do this would be to create a class that contains only pure
virtual functions and use that as your interface. Then use multiple
inheritance to implement the interface (which is safe because all
theinterface functions are pure virtual). However, this is somewhat limiting
because your interface cannot inherit any Qt classes and therefore cannot
contain signal or slot declarations.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110222/21f02135/attachment.html 


More information about the Qt-interest-old mailing list