Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multi-level linheritance

Status
Not open for further replies.

mais123

Programmer
Dec 26, 2007
36
US
Hi, I have a class that inherits from another class, which in turn inherits from a base class. So there are 3 classes. So the second class overides base implementation and the third class overrides some of second class' implementations.
So the problem is as follows: third class calls a method that is defined in second class(not overriden in third class). That method in turn calls a method that is defined in base class, overriden in second class, AND also overriden in third class. So I expect the method implementation of THIRD class to execute. Instead the second class' imlementation gets executed. Why?

Thanks
 
because second class has no idea that third class exists and it can only execute what it knows. that means himself and any baseclasses it overrides.

you could pass in a delegeate to make this work though.

Christiaan Baes
Belgium

My Blog
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top