| Author |
Converting base clas to derived class
|
Jothi Prasadh
Greenhorn
Joined: Apr 23, 2006
Posts: 1
|
|
Hi, I have a class A which has two subclass B and C.A is associated with a class D.but if i want to store the B objects in D.How can i store B/C objects in D.. Thanks, Anandh
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24061
|
|
Hi, Welcome to JavaRanch! You'll have to be a bit clearer as to what you're asking here; what does "is associated with" mean, exactly? But perhaps it would help you to know that any method that accepts an A as an argument will automatically accept a B or a C, and any variable of type A can, again, automatically, refer to a B or a C, if you make the assignment.
|
[Jess in Action][AskingGoodQuestions]
|
 |
 |
|
|
subject: Converting base clas to derived class
|
|
|