V
velthuijsen
I've got a data class.
There is one point in the program I'm writing that needs access to the
non const functions of this class.
The rest of the program only needs the getters.
Currently I've solved this by handing out const pointers to this data
class to be used by the rest of the program.
But I don't like showing the non const functions to parts of the
program that just don't need them.
So I basically want two interfaces to the same underlying data.
One that allows reads and one that allows reads & writes.
Is this possible at all? If so where can I find an example/tutorial on
the net about it or in what book about C++ is this described?
P.s. while writing this I got an idea about a possible solution using
a base class with only the getters and a derived class that contains
the rest.
There is one point in the program I'm writing that needs access to the
non const functions of this class.
The rest of the program only needs the getters.
Currently I've solved this by handing out const pointers to this data
class to be used by the rest of the program.
But I don't like showing the non const functions to parts of the
program that just don't need them.
So I basically want two interfaces to the same underlying data.
One that allows reads and one that allows reads & writes.
Is this possible at all? If so where can I find an example/tutorial on
the net about it or in what book about C++ is this described?
P.s. while writing this I got an idea about a possible solution using
a base class with only the getters and a derived class that contains
the rest.