Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / docs / ecma334 / 17.5.5.xml
1 <?xml version="1.0"?>
2 <clause number="17.5.5" title="Sealed methods">
3   <paragraph>When an instance method declaration includes a sealed modifier, that method is said to be a sealed method. A sealed method overrides an inherited virtual method with the same signature. An override method can also be marked with the sealed modifier. Use of this modifier prevents a derived class from further overriding the method. </paragraph>
4   <paragraph>
5     <example>[Example: The example <code_example><![CDATA[
6 using System;  
7 class A  
8 {  
9    public virtual void F() {  
10       Console.WriteLine("A.F");  
11    }  
12    public virtual void G() {  
13       Console.WriteLine("A.G");  
14    }  
15 }  
16 class B: A  
17 {  
18    sealed override public void F() {  
19       Console.WriteLine("B.F");  
20    }   
21    override public void G() {  
22       Console.WriteLine("B.G");  
23    }   
24 }  
25 class C: B  
26 {  
27    override public void G() {  
28       Console.WriteLine("C.G");  
29    }  
30 }  
31 ]]></code_example>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]</example>
32   </paragraph>
33 </clause>