I’d like to create an object used to store data, restricting read/write access.
For example :
OBJ obj1;
OBJ obj2;
// DataOBJ has 2 methods : read() and write()
DataOBJ dataOBJ1 (obj1);
With the code above, I want obj1 to access write() method, while other OBJ objects (obj2 in this case) should only access the read() method.
Is it possible to create a DataOBJ class restricting rights like that ?
The classical “getter setter” does not suit my needs.
Thanks.
You can control access to write/read by template global reference obj1/obj2 like in this example: