I'm trying to setup an array with my class where i can input how large i want the array to be but can't seem to get it working.
Code: Select all
//Civs.h
class CCivs
{
public:
CCivs( void );
CCivs( int NoOfWaypoints ); //NoOfWaypoints is the size i want
~CCivs(void);
private:
int waypoints; // an int to hold the array?! - not sure what to do here?!
};
Code: Select all
// method in Civs.cpp
CCivs::CCivs( int NoOfWaypoints )
{
// I want to be able to create a new array with this size
waypoints = new waypoints[NoOfWaypoints];
}
Many thanks in advance and sorry to trouble you with something that'll probably be a basic programming problem.
Many thanks, Matt.