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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
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: 19784
    
  20



SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Simple oop question - duplicate call to different instance