Delphi Language Guide Delphi for Microsoft Win32 Delphi for the Microsoft. Net framework



Yüklə 0,84 Mb.
Pdf görüntüsü
səhifə193/294
tarix02.01.2022
ölçüsü0,84 Mb.
#41395
1   ...   189   190   191   192   193   194   195   196   ...   294
DelphiLanguageGuide

Nested Type Declarations
Type declarations may be nested within class declarations. Nested types are used throughout the .NET framework,
and throughout object-oriented programming in general. They present a way to keep conceptually related types
together, and to avoid name collisions. The same syntax for declaring nested types may be used with the Win32
Delphi compiler.
Declaring Nested Types
type
  className = class [abstract | sealed] (ancestorType)
      memberList
      type
         nestedTypeDeclaration 
      memberList
  end;           
Where nestedTypeDeclaration follows the type declaration syntax defined in Declaring Types.
Nested type declarations are terminated by the first occurance of a non-identifier token, for example, procedure,
class, type, and all visibility scope specifiers.
The normal accessibility rules apply to nested types and their containing types. A nested type can access an instance
variable (field, property, or method) of its container class, but it must have an object reference to do so. A nested
type can access class fields, class properties, and class static methods without an object reference, but the normal
Delphi visibility rules apply.
Nested types do not increase the size of the containing class. In other words, creating an instance of the containing
class does not also create an instance of a nested type. Nested types are associated with their containing classes
only by the context of their declaration.

Yüklə 0,84 Mb.

Dostları ilə paylaş:
1   ...   189   190   191   192   193   194   195   196   ...   294




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin