Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / March 2006

Tip: Looking for answers? Try searching our database.

override and internal

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeremy Chapman - 02 Mar 2006 17:33 GMT
In a base class, a method is declared protected internal virtual object
SaveViewState();

I can override it protected virtual object SaveViewState(); but I can not
add the internal keyword.  Why not?
Vadym Stetsyak - 02 Mar 2006 17:54 GMT
Hello, Jeremy!

JC> In a base class, a method is declared protected internal virtual object
JC> SaveViewState();

JC> I can override it protected virtual object SaveViewState(); but I can
JC> not add the internal keyword.  Why not?

Compiles fine, on .NET 2.0 VS2005

class A {
  protected internal virtual object SaveViewState()
  {
      return null;
   }

}

class B : A {
   protected internal override object SaveViewState()
   {
       return base.SaveViewState();
   }
}
--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Jeremy Chapman - 02 Mar 2006 19:49 GMT
That's wierd.  I get the following error:

Error 1 'Custom.Web.UI.WebControls.MyStyle.SaveViewState()': cannot change
access modifiers when overriding 'protected' inherited member
'System.Web.UI.WebControls.Style.SaveViewState()' C:\Develop\2.0\Class
Libraries\Web.UI.WebControls\MyTest\MyStyle.cs 32 48
Custom.Web.UI.WebControls.MyStyle

public class MyStyle : Style
{
   public MyStyle(): base()
   {
   }

   public MyStyle(StateBag bag) : base(bag)
   {
   }

   protected internal override object SaveViewState()
   {
       return base.SaveViewState();
   }
}

> Hello, Jeremy!
>
[quoted text clipped - 24 lines]
> Regards, Vadym Stetsyak
> www: http://vadmyst.blogspot.com 

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.