jeudi 19 septembre 2019

Design-pattern to limit access one class to another

I have class Shop and class Customer. So I want to specify the way class Customer can interract with class Shop (could not have access to some methods and fields). As far as I understand I need the third class wich will be inherited from Shop class and override access to this fields and methods. At the same time I want to create new Customer instance via Shop class and store all customers there. This means cyclic imports and this is not good. What kind of pattern you could advice me in this situation?

Aucun commentaire:

Enregistrer un commentaire