Im come from Java, and Im revisiting the Head First Design Patterns book, this is the bible to Design patterns according to some developers. Im trying to recreate the Duck Simulator from the book from Java to obj-c, this is what I have so far:
This simulator uses the Strategy Pattern that is applied using protocols. I have 2 problems with my implementation:
1- I cant have the Duck class to be abstract like in the Java version, on the Java version the method "display()" is abstract and should be implemented by children classes.
2- I had to expose the Duck class properties so children classes have access to them, this is not like in Java in which private properties can be seen by children classes.
What would be the ideal design for this solution?
Thank you
Aucun commentaire:
Enregistrer un commentaire