Hi.
I need some advice regarding the following:
I have an abstract class named Terrain, and a class named RoadMap, which supposed to hold an N*N array of Terrains.
But I'm not sure what type should the RoadMap class hold:
Code:
#ifndef TERRAIN_H
#define TERRAIN_H
class Terrain {
public:
virtual ~Terrain(){}
virtual unsigned getCost()=0;
};
#endif /* TERRAIN_H */
and:
Code:
#ifndef ROADMAP_H
#define ROADMAP_H
#include"Terrain.h"
class RoadMap {
public:
RoadMap(int size); // to be determined at runtime
virtual ~RoadMap();
private:
/* Two dimentional array of size*size Terrains */
int terrain_size;
};
#endif /* ROADMAP_H */
I can't use an array of refernces here, so I tried this:
and then I thought this was the way to go:
Code:
Terrain (*terrain)[];
But now I'm not sure.
The N*N matrix size supposed to be determined according to a given input...
What type should I use there?