Original Post
Hi there this is a bit weird but for the current situation preferred way to store data.
I need to define and save some static data in my headerfile.
Iv got my object
I need 2...X lists of this object type. The lists are static and should not change.
Is the correct format?
And Lastly i need an array with pointers to allt lists i have already created( IF there is a better solution i am happy to try it out )
Main problems I encounter depending on how I write is either "ListList is already defined" although I already use #ifndef "DATA_H" #define "DATA_H" and #endif in the datafile. main.cpp and anotherobject.cpp includes data.h file.
The other problem i encounter is
cannot convert from 'MyObject *const [3]' to 'const MyObject **const '
Any suggestions or alternate solutions are welcome. The code is not really performance dependent but reading writing from disk and or database is not preferred.
~Athos
I need to define and save some static data in my headerfile.
Iv got my object
struct MyObject{int x;int y;MyObject(x,y){x = x; y=y;}}I need 2...X lists of this object type. The lists are static and should not change.
Is the correct format?
const MyObject* const List1[] ={ new MyObject(5,6), new MyObject(5,6), new MyObject(5,6), 0}And Lastly i need an array with pointers to allt lists i have already created( IF there is a better solution i am happy to try it out )
const MyObject** const ListList[] = {List1,List2,..}Main problems I encounter depending on how I write is either "ListList is already defined" although I already use #ifndef "DATA_H" #define "DATA_H" and #endif in the datafile. main.cpp and anotherobject.cpp includes data.h file.
The other problem i encounter is
cannot convert from 'MyObject *const [3]' to 'const MyObject **const '
Any suggestions or alternate solutions are welcome. The code is not really performance dependent but reading writing from disk and or database is not preferred.
~Athos