I'm making a class with various functions for finding the shortest path from one spot on a map to another around "terrain". I haven't used c++ in awhile, and I am not quite sure how to go about passing 2d char array of an unknown size into my class.
Here is just a general layout of my class so far:
How do I pass into my constructor ShortPath(char** m) a 2d array of [8][8].Code:class ShortPath { private: struct List { List* node; int f; int h; int g; }*oRoot,*cRoot; void listAdd(List* l); public: ShortPath(char** m); ShortPath(char** m, char* d); ~ShortPath(); int getShortPathSteps(void); void findShortPath(char** m); void getShortPath(char** m, char* d); };
ShortPath find = new ShortPath(arr2d); // doesn't work
I've tried many other things to get it to work too >.>, most it does is go in and doesn't get the even the values. I stored into arr2d. Basically what I THINK I want to do is pass in a pointer to my 2d array.
Probably a better one to structure my class, any recommendations would be awesome <3.



LinkBack URL
About LinkBacks



