aspose file tools*
The moose likes Java in General and the fly likes Converting base clas to derived class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Converting base clas to derived class" Watch "Converting base clas to derived class" New topic
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: 24187
    
  34

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]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Converting base clas to derived class