Ismael, The answer to your question is right in the book itself: Using interfaces. Given on Page 96:
You could simply put the animate() code in GameShape, and then disable the method in classes that can't be animated. But that's a bad design choice.
The code for the Animatable interface is also given.
Hope your question is answered.
Joined: Feb 15, 2007
Vidhya, there are two solutions for the problem of disable the animate() method code given at page 96. One is not directly given. It is only named as 'bad design'. Second is the one about using interfaces, which cannot be named as 'bad design'. I believe you talk about the second solution, while I'm interested in first one
Julio, I'm not sure if making the method final in parent class would be a good solution since the goal is to disable it only to some of the children classes.