Re: Overriding properties and events
From: Scott M. (s-mar_at_nospam.nospam)
Date: 09/07/04
- Next message: DanP: "Crystal Report Viewer"
- Previous message: Jon Skeet [C# MVP]: "Re: Microsoft: Get rid of VB.NET -- now !"
- In reply to: Edward Diener: "Re: Overriding properties and events"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 7 Sep 2004 10:27:49 -0400
No, Shadowed members replace the implementation of the base class member.
The difference between Shadows and Overrides is that to Override, you need
permission from the base class (the base class member must be declared as
Overrideable). With Shadows, you do not need "permission" from the base
class.
"Edward Diener" <eddielee@tropicsoft.com> wrote in message
news:%23$%238917kEHA.208@TK2MSFTNGP12.phx.gbl...
> Scott M. wrote:
>> Only if the base class has that item marked as overrideable. If not,
>> you'll need to use Shadows.
>
> I assume when you say Shadows you mean that the derived class creates a
> property or event with the same name as the base class and calls down to
> the
> base class as needed.
>
> What in the documentation tells me if the item is marked as overrideable ?
> If I look at the MSDN documentation for the .NET framework and I see a
> property for a class, I see no mention of overrideable in any language
> example for get or set functions. Can you point me to a property in the
> documentation which shows this ?
>
> As far as events are concerned, I was thinking of the ability to override
> the adding, removing, and/or raising of an event. Yet documentation for an
> event tells me nothing about these individual event functions for a given
> event but just about the event itself. For my own events I make them
> virtual
> in C++ and, I believe, all functions are virtual in C#. Can I override the
> add_XXX, remove_XXX, or raise_XXX for a public event ? What abouyt for a
> protected event ?
>
>>
>>
>> "Edward Diener" <eddielee@tropicsoft.com> wrote in message
>> news:%23s5gdm7kEHA.3988@tk2msftngp13.phx.gbl...
>>> Is it possible for a derived class to override a property and/or
>>> event of its base class ?
>
>
- Next message: DanP: "Crystal Report Viewer"
- Previous message: Jon Skeet [C# MVP]: "Re: Microsoft: Get rid of VB.NET -- now !"
- In reply to: Edward Diener: "Re: Overriding properties and events"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|