SABYASACHI,

The derived class is more specialized than the base-class. An instance
of the Base class cannot be as specialized as the derived class, so
you can't call methods of the derived class.

The other way around is OK however. The more specialized derived class
has features available from the base class.

If the method you're trying to call doesn't use the more sepcializzed
features of the derived class, or has nothing to do with being more
specialized, you should consider moving the method up to the
base-class. If you do so, you wille be able to call this method, as
the base-class implements it.

good luck,

Joost Helberg

>>>>> "SABYASACHI" == SABYASACHI S GUPTA <[EMAIL PROTECTED]> writes:


    SABYASACHI> In java explicit typecasting is allowed. Now if I have
    SABYASACHI> 1. Instance of Base class
    SABYASACHI> 2. Name of derived class

    SABYASACHI> Can I call a method of a derived class object through the base
    SABYASACHI> class instance.

    SABYASACHI> theComponentApp = selAppComp[i].getInstance(); //Base class instance.

    SABYASACHI> try{

    SABYASACHI>         String compName = selAppComp[i].getComponentName(); //Derived
    SABYASACHI> class Name.

    SABYASACHI>         Vector template = (???)theComponentApp.templateInfo();
    SABYASACHI> }  //What to do here? templateInfo is a function of Derived class..



    SABYASACHI> ----------------------------------------------------------------------
    SABYASACHI> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
    SABYASACHI> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

-- 
Joost Helberg                      Unix consultants      v   v
[EMAIL PROTECTED]                       OO developers         \ /
                                 ###   ##    ##  #     >---X---<
http://snow.nl                  #     #  #  #  # #  #  #  / \
Snow B.V.                        ##   #  #  #  # #  #  # ^   ^
Tel. 0418-653333                   #  #  #  #  # #  #  #
Fax. 0418-653666                ###   #  #   ##   ## ##
PGP PblKey fprnt=4D BD 6A 45 6A 86 81 59  0D BA 7D D4 B2 F8 63 34


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to