I have a class A that has objects of type C, D, E, F, etc. in it, all of which inherit the base class B. I am trying to include the header for class B, but my code won't compile since I have a pure virtual function in B
Classes of type C, D, E, F, etc override the virtual function, but including the class B header in the class A header to allow for std::vector<B> objects;
causes an issue. Is there any way around this? I know I can make the function not virtual, but I want to keep the base class as is and be able to use the name in class A for polymorphism
A.h:
#include "B.h"
class A {
private:
std::vector<B> objects;
// ...
}
B.h:
class B {
public:
virtual void doSomething() = 0;
// ...
}