Hi guys I have problem calling the method in the subclass. For example, I get error for the bold line.
what should i do to call the subclass method? Thanks
posted 12 years ago
You can't do that! When you declare obj as a variable of type SuperA, you only get access to the methods defined in SuperA. You can override these methods in SubB1 or SubB2 to get a different behavior but to get to a "new" method defined in SubB1 you must declare an object of type SubB1.