Hi,
I'm confronted with a problem that seems not to be solvable. In
general: How can I override an interface member of my base class and
call the overridden method from my derived class?
This is my class:
class RemoteXmlDataSo urce : System.Web.UI.W ebControls.XmlD ataSource
And I want to override
DataSourceView System.Web.UI.I DataSource.GetV iew(string viewName)
but I want to make a call to the overridden method right after my
stuff.
Declaring the member with override, I get the message
The modifier 'override' is not valid for this item
When trying to access the "overridden " member with
(IDataSource)ba se).GetView(vie wName), I get the message
Use of keyword 'base' is not valid in this context
Ok I understand, my interface member completely replaces the member
from the base class. Is there any way to do this even though?
I tried something like
((IDataSource)( XmlDataSource)t his).GetView(vi ewName)
but that just calls my new member :)
That makes deriving much harder than just overriding a virtual method
and calling base.X()... But I hope I just did not fully understand ;)
Kind regards, Sebastian
I'm confronted with a problem that seems not to be solvable. In
general: How can I override an interface member of my base class and
call the overridden method from my derived class?
This is my class:
class RemoteXmlDataSo urce : System.Web.UI.W ebControls.XmlD ataSource
And I want to override
DataSourceView System.Web.UI.I DataSource.GetV iew(string viewName)
but I want to make a call to the overridden method right after my
stuff.
Declaring the member with override, I get the message
The modifier 'override' is not valid for this item
When trying to access the "overridden " member with
(IDataSource)ba se).GetView(vie wName), I get the message
Use of keyword 'base' is not valid in this context
Ok I understand, my interface member completely replaces the member
from the base class. Is there any way to do this even though?
I tried something like
((IDataSource)( XmlDataSource)t his).GetView(vi ewName)
but that just calls my new member :)
That makes deriving much harder than just overriding a virtual method
and calling base.X()... But I hope I just did not fully understand ;)
Kind regards, Sebastian
Comment