Jon Jagger
jon@jaggersoft.com
Table of Contents 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Notes DownloadECMA-334 C# Language Specificationpreviousnextprevious at this levelnext at this level 17 Classesprevious at this levelnext at this level 17.5 Methodsprevious at this levelnext at this level 17.5.5 Sealed methods Paragraph 11 When an instance method declaration includes a sealed modifier, that method is said to be a sealed method. 2 A sealed method overrides an inherited virtual method with the same signature. 3 An override method can also be marked with the sealed modifier. 4 Use of this modifier prevents a derived class from further overriding the method. [Example: The example
using System;  
class A  
{  
   public virtual void F() {  
      Console.WriteLine("A.F");  
   }  
   public virtual void G() {  
      Console.WriteLine("A.G");  
   }  
}  
class B: A  
{  
   sealed override public void F() {  
      Console.WriteLine("B.F");  
   }   
   override public void G() {  
      Console.WriteLine("B.G");  
   }   
}  
class C: B  
{  
   override public void G() {  
      Console.WriteLine("C.G");  
   }  
}  
the class B provides two override methods: an F method that has the sealed modifier and a G method that does not. B's use of the sealed modifier prevents C from further overriding F. end example]
{ JSL }
Jagger Software Ltd
Company # 4070126
VAT # 762 5213 42
Valid HTML 4.01Valid CSS