Live Curious!!!
Sagar Dabas wrote:Isn't it inheritance is just a waste?
Jesper de Jong wrote:
Sagar Dabas wrote:Isn't it inheritance is just a waste?
No, it's very useful. And implementing interfaces is also inheritance.
Seetharaman Venkatasamy wrote:
https://coderanch.com/t/564467/java/java/why-there-no-multiple-inheritance
see the Jeff reply!
Live Curious!!!
Sagar Dabas wrote:I know about IS-A relationship but I think the use of inheritance is just polymorphism when we override some methods.
Code reuse doesn't seem to be a good use of inheritance as we can do that using objects.
And what's "implementing" interfaces, isn't it doing what inheritance should do?
Isn't inheritance is just a waste ? ( I am not mature to say that )
Or for just giving an OO view to your application inheritance should be chosen? For example : Tiger is a Cat but not Catable
Sagar Dabas wrote:
Jesper de Jong wrote:
Sagar Dabas wrote:Isn't it inheritance is just a waste?
No, it's very useful. And implementing interfaces is also inheritance.
How ?
Ok then, what extending can do which implementing cannot do? Is it just the CODE REUSE ?
Jeff Verdegan wrote:
Ok then, what extending can do which implementing cannot do? Is it just the CODE REUSE ?
Yup. That's it. And that is valuable, when used properly.
Live Curious!!!
Jeff Verdegan wrote:
Sagar Dabas wrote:Ok then, what extending can do which implementing cannot do? Is it just the CODE REUSE ?
Yup. That's it. And that is valuable, when used properly.
Dennis Deems wrote:
Jeff Verdegan wrote:
Sagar Dabas wrote:Ok then, what extending can do which implementing cannot do? Is it just the CODE REUSE ?
Yup. That's it. And that is valuable, when used properly.
Wait, are you saying that a class hierarchy has no value in itself? Cause if you are, I vehemently disagree.
Jeff Verdegan wrote:
Dennis Deems wrote:
Jeff Verdegan wrote:
Sagar Dabas wrote:Ok then, what extending can do which implementing cannot do? Is it just the CODE REUSE ?
Yup. That's it. And that is valuable, when used properly.
Wait, are you saying that a class hierarchy has no value in itself? Cause if you are, I vehemently disagree.
No, no, not at all. I'm simply saying that the only thing that extending a class gives you that you don't get from implementing an interface is code reuse.
Dennis Deems wrote:
Jeff Verdegan wrote:
Dennis Deems wrote:
Jeff Verdegan wrote:
Sagar Dabas wrote:Ok then, what extending can do which implementing cannot do? Is it just the CODE REUSE ?
Yup. That's it. And that is valuable, when used properly.
Wait, are you saying that a class hierarchy has no value in itself? Cause if you are, I vehemently disagree.
No, no, not at all. I'm simply saying that the only thing that extending a class gives you that you don't get from implementing an interface is code reuse.
But I still disagree. Extending a class gives you a place in a class hierarchy.
Implementing an interface does not.
Implementing Quackable doesn't make you a duck.
Implementing every interface implemented by Duck doesn't make you a duck. Extending Duck does this.