Re: Difference between C#'s "new" keyword and VB.NET's "shadows" keyword

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Frans Bouma [C# MVP] (perseus.usenetNOSPAM_at_xs4all.nl)
Date: 08/28/04


Date: Sat, 28 Aug 2004 10:49:32 -0700

Dot net work wrote:

> I need VB.NET's "shadows" functionality inside a C# project.
>
> I tried the "new" keyword, but it didn't seem to work, because my
> particular function does in fact differ in signature to the function
> that is being hidden in the base class.
>
> In VB.NET, the shadows keyword hides all the inherited functions,
> regardless of signature.
>
> I need this functionality in C#.
>
> I'm sure there's an easy way around this, but I am a VB.NET
> programmer, and not a C# programmer.

        Even though shadows seems to hide it, it isn't hidden. Everyone can reach
the base class methods through reflection.

                FB

-- 
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP


Relevant Pages

  • Re: How about "pure virtual methods"?
    ... Programmer A designs a base class some of whose methods are ... Programmer B designs a sub-class, ...
    (comp.lang.python)
  • Re: strange compiler message
    ... >> an int but an object of class Foo. ... > Because the user/programmer does not see the functions signature at ... > the programmer is just sloppy. ... the programmer would still know that " blah blah " would not get modified. ...
    (comp.lang.cpp)
  • Re: Suggestion
    ... > problems when changing the signature of the function in the base class, ... > and forgetting to change the signature of the derived functions ... Accessing the objects with base class pointers, ... > This has made me come up with an idea for a compiler/language feature that ...
    (comp.lang.cpp)
  • Re: Inheritance question
    ... telling the programmer that "This property is not intended for public use ... >> always be possible for clients to use a derived subclass as if it were a ... >> base class without knowing it. ... > I'm writing an extension of TreeView in which a few properties of TreeView ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Suggestion
    ... > problems when changing the signature of the function in the base class, ... (Most often when only some of the derived classes redefine ... Accessing the objects with base class pointers, ... where I've seen a few TDD groups fall short from inexperience. ...
    (comp.lang.cpp)