Re: changing access modifier of base method

Tech-Archive recommends: Fix windows errors by optimizing your registry



jonpb <nospam@xxxxxxxxxx> wrote:
I have implemented an InputBox dialogue, I would like to change the
access modifier of the Form::Show method from public to private, but the
following code does not do that. What else do I need to do? Thanks.

There's nothing you can do. The way that inheritance works, a caller
should be able to treat an instance of your class as an instance of
Form - including calling the Show method. If you don't want to expose a
Show method, you shouldn't derive from Form.

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
.



Relevant Pages

  • Re: Overrides BackgroundImage()
    ... access modifier for the property either. ... Private Shadows Property BackgroundImage() As Image ... > Public Overrides Property BackgroundImage() As Image ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: by default, public or private?
    ... "If the Dim statement is used or no access modifier ... private in Visual C# structures. ... the most you can limit the access level, and even all Private variables ...
    (microsoft.public.dotnet.languages.vb)
  • Re: by default, public or private?
    ... "If the Dim statement is used or no access modifier ... private in Visual C# structures. ...
    (microsoft.public.dotnet.languages.vb)
  • delegate object as an argument
    ... I tried to pass a delegate object to a function, ... access modifier is private but gives me a compile error when the ... private void testfunction2//works fine ...
    (microsoft.public.dotnet.languages.csharp)