Re: static virtual/override
- From: Jon Shemitz <jon@xxxxxxxxxxxxxxxxx>
- Date: Fri, 19 Aug 2005 19:27:09 -0700
Tony Maresca wrote:
> Don't know if there are any Delphi/Object Pascal converts
> here,
I see quite a few, actually.
> I sorely miss the feature that permits
> class (e.g., static) methods to be virtual and be overridden
> in derived classes.
Why? Just curious.
> public class Foo
> {
> static void SomeMethod()
> {
> }
> }
>
> public class Bar : Foo
> {
> }
>
> Bar ABar = new Bar();
> ABar.SomeMethod();
This won't compile ... you want Bar.SomeMethod() ....
> In the above, I want the method implementation
> in Foo() to determine the class it was called through
> (in this case, Bar).
I'm drawing a blank. System.Reflection.MethodBase.GetCurrentMethod()
returns the current method, but when you call Foo.SomeMethod as
Bar.SomeMethod(), the MethodBase shows Foo for both the DeclaringType
and the ReflectedType.
Does it HAVE to be a static method?
--
www.midnightbeach.com
.
- Prev by Date: Re: How to convert 1223/100 to 12.23 not 12 in sql server?
- Next by Date: The :: operator, and "global"
- Previous by thread: How to convert 1223/100 to 12.23 not 12 in sql server?
- Next by thread: Re: static virtual/override
- Index(es):
Relevant Pages
|