Skip to content
Prev 42862 / 398506 Next

reference to objects

Thanks for your answer,
The data should be read only (and all the objects share the same data values).
The problem with this solution is that I would like to use those objects with
already existing libraries, and thus I cannot choose how the data is read.
To explain better, I look for a way to reference to the data that is transparent
to the application.

In C this would be done by assigning the pointer to the data structure, for example
if dist is a C structure and obj1/2 contain a pointer called dist to that kind of
structure, I would do:

obj1->dist = &dist;
obj2->dist = &dist;

and then the rest of the code would not even know if obj1->dist is shared among different
objects....

Thanks again,
Giampiero