X hits on this document

1039 views

0 shares

0 downloads

0 comments

216 / 396

Chapter ‎18   Unsafe code

A nested type that is declared in a class can have any of five forms of declared accessibility (public, protected internal, protected, internal, or private) and, like other class members, defaults to private declared accessibility.

A nested type that is declared in a struct can have any of three forms of declared accessibility (public, internal, or private) and, like other struct members, defaults to private declared accessibility.

The example

public class List { // Private data structure private class Node { public object Data; public Node Next;

public Node(object data, Node next) { this.Data = data; this.Next = next; } }

private Node first = null; private Node last = null;

// Public interface

public void AddToFront(object o) {...}

public void AddToBack(object o) {...}

public object RemoveFromFront() {...}

public object RemoveFromBack() {...}

public int Count { get {...} } }

declares a private nested class Node.

10.2.6.3 Hiding

A nested type may hide (§‎3.7.1) a base member. The new modifier is permitted on nested type declarations so that hiding can be expressed explicitly. The example

using System;

class Base { public static void M() { Console.WriteLine("Base.M"); } }

Copyright Microsoft Corporation 1999-2003. All Rights Reserved.203

Document info
Document views1039
Page views1039
Page last viewedSat Dec 10 08:26:14 UTC 2016
Pages396
Paragraphs9401
Words133190

Comments