C
Christofer Fransson
Hi,
I have a huge datafile that I store in a std::map structure. I have
created a small class that handles parsing and memory allocation of
the datafile in a class called that we can call MyData.
I would like this MyData class to be known to an hierarcy of classes.
I do not want it as a baseclass because I only whish to have one
instance of it.
My solution right now is to submit a pointer to every constructor in
my class hiearacy that would like to get access from my class MyData.
I assume that this solution is an ugly implementation.
I dont like global variables.
What should I do? Put the MyData class as a static member at the top
of my class hierarcy?
Best regards,
Christofer
I have a huge datafile that I store in a std::map structure. I have
created a small class that handles parsing and memory allocation of
the datafile in a class called that we can call MyData.
I would like this MyData class to be known to an hierarcy of classes.
I do not want it as a baseclass because I only whish to have one
instance of it.
My solution right now is to submit a pointer to every constructor in
my class hiearacy that would like to get access from my class MyData.
I assume that this solution is an ugly implementation.
I dont like global variables.
What should I do? Put the MyData class as a static member at the top
of my class hierarcy?
Best regards,
Christofer