We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Classes, classes, classes! (and games)
Pages: 1 2 3 
Classes, classes, classes! (and games) (Read 4018 times)
Re: Classes, classes, classes! (and games)
Reply #30 - Jan 5th, 2010, 5:10am
 
"The use of instanceof is frowned upon, as it bypasses the fundamentals of inheritance."
Indeed, but the example was about unrelated classes. And as you wrote too: "if they are unrelated, why would you group them" Smiley
The example you gave was about related classes, since they have draw() in common.
That's where inheritance shines and indeed makes instanceof or switch unneeded.
Pages: 1 2 3