I have a class IBase with only pure virtual functions. I have another class Derived which inherits IBase. I have a function in another class that takes a QVector of IBase as a parameter. When I create a QVector of Derived objects, I can't pass them into this function. However, I can have a function that takes a IBase object as an argument and pass in a Derived object instance. Why is this behavior occurring?
Asked
Active
Viewed 36 times
0
-
The dupe uses `std::vector` but `Qvector` behaves the same way. – NathanOliver May 09 '19 at 14:25
-
Because a `Derived` is also a `IBase`, but `QVector
` is not `QVector – vahancho May 09 '19 at 14:28`. -
Thanks @NathanOliver – JComputerScience May 09 '19 at 14:50