This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Simple oop question - duplicate call to different instance

 
Sharon whipple
Ranch Hand
Posts: 294
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry if the title unclear, I will explain:
Say I got abstract class ABS with some methods implemented in it:


And two derived classes FOO,BAR


Now I would like to create list of ABS



How do i avoid the duplicate calles to setId, setName,setSerialNumber in the If clause?
Thank you
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Sharon whipple
Ranch Hand
Posts: 294
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you,how do you deal with instantiating FOO,BAR
And avoid the ugly casting from ABS to FOO,BAR?

 
Rob Spoor
Sheriff
Pie
Posts: 20376
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic