aspose file tools
The moose likes Beginning Java and the fly likes Simple oop question - duplicate call to different instance Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Simple oop question - duplicate call to different instance" Watch "Simple oop question - duplicate call to different instance" New topic
Author

Simple oop question - duplicate call to different instance

Sharon whipple
Ranch Hand

Joined: Jul 31, 2003
Posts: 294
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

Joined: Jan 28, 2008
Posts: 5575

Sharon whipple
Ranch Hand

Joined: Jul 31, 2003
Posts: 294
Thank you,how do you deal with instantiating FOO,BAR
And avoid the ugly casting from ABS to FOO,BAR?

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19232



SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Simple oop question - duplicate call to different instance
 
Similar Threads
Examlab generics question
How do you extend a generic abstract class
OutPut of abstract class constructor calling method
Not an enclosing class
confused with generics