Re: Override static derived variable
- From: "Joanna Carter \(TeamB\)" <joannac@xxxxxxxxxxxxxxx>
- Date: Sun, 19 Jun 2005 17:10:58 +0100
"Chad Z. Hower aka Kudzu" <cpub@xxxxxxxxx> a écrit dans le message de news:
Xns967AC01FEC6FDcpubhowerorg@xxxxxxxxxxxx
> What code are you using to instantiate them? Statics in .NET are not at
all like in Delphi,
> and Im constantly hitting roadblocks here. I understand why they did it
the way they did,
> and it has some advantages but its requires some royal work arounds
sometimes.
Hi Chad
I am not instantiating them for this example, I am just using static calls
as demonstrated by the OP.
Console.WriteLine(Thing.GetVar());
Console.WriteLine(Derived.GetVar());
Both return "Thing", the Derived static constructor doesn't get called at
all if there is a static constructor on the base class. This seems wierd; I
wasn't expecting virtual/override behaviour, just that the static
constructor on Derived would possibly hide that of Thing, but definitely
that it would get executed.
Can an MVP or someone from MS please confirm that this behaviour is
intentional ?
Joanna (Another frustrated Delphi OO expert)
--
Joanna Carter
Consultant Software Engineer
.
- Follow-Ups:
- Re: Override static derived variable
- From: Jon Skeet [C# MVP]
- Re: Override static derived variable
- References:
- Override static derived variable
- From: knocte
- Re: Override static derived variable
- From: Joanna Carter \(TeamB\)
- Re: Override static derived variable
- From: Chad Z. Hower aka Kudzu
- Override static derived variable
- Prev by Date: Re: Override static derived variable
- Next by Date: Re: Override static derived variable
- Previous by thread: Re: Override static derived variable
- Next by thread: Re: Override static derived variable
- Index(es):
Relevant Pages
|
Loading