28 lines
782 B
XML
28 lines
782 B
XML
|
<?xml version="1.0"?>
|
||
|
<clause number="17.2.6.3" title="Hiding">
|
||
|
<paragraph>A nested type may hide (<hyperlink>10.7.1.1</hyperlink>) a base member. The new modifier is permitted on nested type declarations so that hiding can be expressed explicitly. <example>[Example: The example <code_example><![CDATA[
|
||
|
using System;
|
||
|
class Base
|
||
|
{
|
||
|
public static void M() {
|
||
|
Console.WriteLine("Base.M");
|
||
|
}
|
||
|
}
|
||
|
class Derived: Base
|
||
|
{
|
||
|
new public class M
|
||
|
{
|
||
|
public static void F() {
|
||
|
Console.WriteLine("Derived.M.F");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
class Test
|
||
|
{
|
||
|
static void Main() {
|
||
|
Derived.M.F();
|
||
|
}
|
||
|
}
|
||
|
]]></code_example>shows a nested class M that hides the method M defined in Base. end example]</example> </paragraph>
|
||
|
</clause>
|