O'Reilly logo
  • Giovanni Armeno thinks this is interesting:

How do you know whether to make a class, a subclass, an abstract class, or an interface?

  • Make a class that doesn’t extend anything (other than Object) when your new class doesn’t pass the IS-A test for any other type.

  • Make a subclass (in other words, extend a class) only when you need to make a more specific version of a class and need to override or add new behaviors.

  • Use an abstract class when you want to define a template for a gr...


Cover of Head First Java, 2nd Edition


Quando fare classi astratte, sottoclassi, classi astratte e interfacce