M
Mythran
Attached is the shortest complete program I could come up with that
demonstrates a current problem we are having with some libraries that have
classes that inherit from System.Web.UI.Page, extend it, and then has other
classes inherit from those derived classes.
So, to explain the attached projects...there are 2 solutions...one is a
solution written with Visual Studio .Net 2003 (v1.1) and the other is
written with Visual Studio 2008 (v2.0).
v1.1 Contains TestLibrary and TestLibrary2 projects.
v2.0 Contains TestLibrary and a console project.
v1.1 TestLibrary has a class named BaseClass. v1.1 TestLibrary2 has a class
named DerivedClass which inherits from BaseClass.
v2.0 TestLibrary has a class named BaseClass. The v2.0 console application
project has a class named DerivedClass2 which inherits from DerivedClass.
The console program shows that even though v1.1 TestLibrary2 DerivedClass
inherits from v1.1 TestLibrary, it is actually inheriting from v2.0
TestLibrary (which is fine and what we want). What we don't get is that
both v1.1 TestLibrary2's DerivedClass has a method named GetBaseValue that
returns a string. The v2.0 TestLibrary's BaseClass also has a method named
GetBaseValue that returns an INTEGER. Using reflection, we show that both
methods ARE defined and functional. When we call GetBaseValue directly,
from within the console, without using reflection, the GetBaseValue from
v1.1 TestLibrary2's DerivedClass is called. How does this work? How does
the .Net Framework determine which method to call? There is no
overloading/overriding done here...so what's going on?
Thanks,
Mythran
demonstrates a current problem we are having with some libraries that have
classes that inherit from System.Web.UI.Page, extend it, and then has other
classes inherit from those derived classes.
So, to explain the attached projects...there are 2 solutions...one is a
solution written with Visual Studio .Net 2003 (v1.1) and the other is
written with Visual Studio 2008 (v2.0).
v1.1 Contains TestLibrary and TestLibrary2 projects.
v2.0 Contains TestLibrary and a console project.
v1.1 TestLibrary has a class named BaseClass. v1.1 TestLibrary2 has a class
named DerivedClass which inherits from BaseClass.
v2.0 TestLibrary has a class named BaseClass. The v2.0 console application
project has a class named DerivedClass2 which inherits from DerivedClass.
The console program shows that even though v1.1 TestLibrary2 DerivedClass
inherits from v1.1 TestLibrary, it is actually inheriting from v2.0
TestLibrary (which is fine and what we want). What we don't get is that
both v1.1 TestLibrary2's DerivedClass has a method named GetBaseValue that
returns a string. The v2.0 TestLibrary's BaseClass also has a method named
GetBaseValue that returns an INTEGER. Using reflection, we show that both
methods ARE defined and functional. When we call GetBaseValue directly,
from within the console, without using reflection, the GetBaseValue from
v1.1 TestLibrary2's DerivedClass is called. How does this work? How does
the .Net Framework determine which method to call? There is no
overloading/overriding done here...so what's going on?
Thanks,
Mythran