| 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
|
 |
 |
|
|
subject: Simple oop question - duplicate call to different instance
|
|
|