I have an issue with defining some classes in an application I am developing.
The classes hold a hierarchy and the child classes inherit functions from the parent class through polymorphism.
I have defined the parent class(Let's call this class A) and the child classes(B & C) in my menu driver using the #ifndef rule.
The problem is, I have another class(class D) which ideally could do with inheriting from either of the child classes(class B or class C) so I can create a vector of either class B or class C.
Is this possible? If I include the ifndef rule for class B and class C at the top of class D, it throws a hell of alot of errors complaining Class A is undefined. If I don't include the ifndef rule, (no includes at all) then it complains that class B is undeclared, the vector has an unknown size and there's no appropriate constructor available(I assume this is because it doesn't understand what class B is)
Now in my menu driver I create a vector of class A. Inside class A it creates a vector of class B and you can add elements to the vector of class B using functions in class A(or just access it directly as I have below as it's currently public)
Accessing the vector of class A is fine and outputs as it should. But the vector of class B doesn't return what it should.
When I try and access a function (of an element) I get the output:
-1.85119e+062 (it should return a double).