This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

justify answer object reuse  RSS feed

 
venkat lakkakula
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
question: 1.which are following support object reuse?
1.class inheritance
2.object composition
3.java beans
4.attributes
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would go with JavaBeans. "Reusable components JavaBeans"


Thanks,
 
John Stone
Ranch Hand
Posts: 332
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1, inheritance - you are reusing something already written and adding/overiding new stuff
---
2, this is just using old stuff, so I see no reuse here
3, do not know, but looks like using only components already written
4, nonsense

- question says object reuse, so I'm not sure now. I was thinking more about class reuse.
 
Matt Russell
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not clear what is intended by the term "object reuse". I'm guessing it means reuse of implementation, so this is my take given that assumption:

Inheritance and composition are the two big mechanisms for reusing functionality in an object-oriented language. In addition, the idea of JavaBeans, as Chandra points out, is to create reusable software components. Without qualification, the fourth option, "attributes", doesn't make much sense.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!