sealed types and methods. : Sealed : Class C# Examples


C# Examples » Class » Sealed »

 

sealed types and methods.





To prevent a class from being inherited, precede its declaration with sealed.




    
sealed  class  FooSealed  {}

class  BaseClass
{
        protected  virtual  void  Bar()  {  /*...*/  }
}

class  Derived  :  BaseClass
{
        protected  override  sealed  void  Bar()  {  /*  ...  */  }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Class
» Sealed