An instance of B IS-AN A, and an instance of C IS-AN A. So if the array holds elements of type A, there should be no problem in adding instances of B or C.
The trick is in using the array reference to access any methods defined in the subclass (for example, funB()). To do that, you will need to downcast the reference from type A to type B or C. But before you attempt the downcast, you should take some precautions to verify the true runtime type (B or C) -- otherwise, you will get a ClassCastException if the type is wrong.
Have you tried writing any code to experiment with this?
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Originally posted by Stan James: If you are certain you'll only deal with B & C ... create an interface HasFunB that defines funB() and make B and C implement that interface. Then you can make your array hold only HasFunB...