Basically, I have a base class called materials. Materials has many virtual functions, one of them is called a "Double DVD" (Which is a type of material, but is made up of two DVD's which are another material).
So at first I thought I'd store it as either a pair/vector of materials in a derived class called "Set" and have a virtual function defined in material.h that would return a vector of pointers to the two (or more) DVD objects stored.
virtual std::vector<DVD *> getPointers() { return std::vector<DVD *>(); }
However, the problem is that this necessitated the inclusion of "DVD.h" into Materials.h like this:
#ifndef CWK_MAT_H
#define CWK_MAT_H
#include "DVD.h"
#include <string>
#include <vector>
namespace MATERIALS
{
This caused the code to break in absolutely spectacular ways. Is there any way to get around this problem? I need the virtual method to get the pointers to be in the Materials class so that I can access it from this vector:
std::vector<Material *> vect;
As in
vect[1]->getPointers()
I tried to change it to a vector of materials but then it breaks (For some reason makes Visual Studio basically freeze, saying it's updating IntelliSense forever) when I change it to that in the derived class "set" (Set derives from Material, DoubleDVD derives from Set)
Is there any way to do this?