vendredi 10 juillet 2020

Avoid Sub Classing for every specific type

I have a Interface called Animal which has 5 methods (abstract). Now in my Animal kingdom we have 1000(with 1000 different overridden method ) Animals(CAT,DOG,SNAKE....etc) but creating a 1000 different class for all the animals would be hectic and even when they created managing them would be really difficult , any suggestion would be appreciated.... visual presentation is available below.

                                         Animal(I)(5 Methods)
                                ---------------------------------------
                                |     |      |      |    ----------- |
                               DOG   CAT   SNAKE  LION              TIGER

My main goal is to reduce the number of classes .

NOTE: every animal is overriding one or more different methods and are truly different from each other

Aucun commentaire:

Enregistrer un commentaire