mercredi 4 octobre 2017

C++ class design

Maybe this is not pure c++ technical question, but any advice is highly welcome. I need to implement class with many members (let's say A). I also need to access these data by set of other classes and this access should be quite fast (drawing stuff conditioned by members from class A). First approach was to set access level inside A as private and use kind of setters/getters to get particular elements to check (so many method calls). Other approach, just make everything public in A, next one to make dozen of friend classes. To be honest, i do not like any of the above. Rest of system shouldn't have access to A class members at all, only interested ones. Maybe someone had to deal with something similar and could advice some good practice, maybe some appropriate design pattern?

BR, Robert

Aucun commentaire:

Enregistrer un commentaire