There is no emoticon for what I am feeling!
Holla at me...<br /><a href="http://codeforfun.wordpress.com" target="_blank" rel="nofollow">http://codeforfun.wordpress.com</a>
Originally posted by Clifton Craig:
The short answer is, when in doubt use an interface.
There is no emoticon for what I am feeling!
Originally posted by Jeff Albertson:
Good summary Clifton. But for the sake of completeness here's a commonly mentioned reason that may make an abstract class more desirable over an interface.
Suppose you are using the acme.com library, version 1.7. If many of your classes implement its interface Foo, you will in trouble when you switch to version 2.0, which adds seven new methods to Foo. Then all of your concrete Foo implementations won't compile because the compiler insists they should be declared abstract! If you had your classes extend AbstractFoo you'd be laughing, because version 2.0 of AbstractFoo provides default implements of the seven new Foo methods...
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Originally posted by Jeff Albertson:
Suppose you are using the acme.com library, version 1.7. If many of your classes implement its interface Foo, you will in trouble when you switch to version 2.0, which adds seven new methods to Foo. Then all of your concrete Foo implementations won't compile because the compiler insists they should be declared abstract! If you had your classes extend AbstractFoo you'd be laughing, because version 2.0 of AbstractFoo provides default implements of the seven new Foo methods...
Originally posted by Allen Sylvester:
Why will the compiler give an error saying "the implementations should be declared abstract"? Would'nt the message rather be "all interface methods are not implemented"?
There is no emoticon for what I am feeling!
Consider Paul's rocket mass heater. |