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
 
Back
Top