mercredi 30 mars 2016

How to make one method be called by some classes, but the rest could not?

There is one class named ClassA, it has one public function named FunctionA.

There is another class named ClassB, it needs to use FunctionA and it is not a subclass of ClassA.

The third one named ClassC, FunctionA should not be called by ClassC and it is not a subclass of ClassA.

In addition, the relationship between ClassB and ClassC is not inheritance.

If there are some solutions provided? or if there are suitable design patterns?

Thanks for help.

Aucun commentaire:

Enregistrer un commentaire