reverse polymorphism

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Class A extends Control and creates a "new" Size property hiding Size from
the Control class.
A method M from another class (not related to A or Control) has a parameter
of type Control.
Question: If an A object is passed to M, is there a way to call Size from A
instead of Size from Control ?
 
Marco said:
Class A extends Control and creates a "new" Size property hiding Size from
the Control class.
A method M from another class (not related to A or Control) has a parameter
of type Control.
Question: If an A object is passed to M, is there a way to call Size from A
instead of Size from Control ?

I believe that M would have to cast the control as object A first...
Best to inherit M and override control method to accept object A. If
you can that is...

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top