although countless times have helped me on other questions / answers here, this is my first question here, so don't be too hard on me! :)
I studied QT / C ++ and suggested that I have something like this:
class AbstractMasterClass{
public:
virtual void foo(void) = 0;
}
There will be many subclasses in this class, each of which implements its own foo () method. And the question is: how can I create a QList that I will populate with subclasses of AbstractMasterClass?
The goal is to be able to iterate over the list calling the foo () method for each element, i.e. use the master class in the same way as for the Java interface. In several attempts, I received several compile-time errors, stating that we cannot allocate an abstract class object (obviously) when creating a QList.
So how can I do this, or is there a better way to make a Java interface in C ++ / QT?
Thanks to everyone in advance for answering or pointing me in the right direction!
RuiDo source
share