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ə159/294
tarix02.01.2022
ölçüsü0,84 Mb.
#41395
1   ...   155   156   157   158   159   160   161   162   ...   294
DelphiLanguageGuide

Class Fields (.NET)
Class fields are data fields in a class that can be accessed without an object reference.
You can introduce a block of class fields within a class declaration by using the class var block declaration. All fields
declared after class var have static storage attributes. A class var block is terminated by the following:
1
Another class var declaration
138


2
A procedure or function (i.e. method) declaration (including class procedures and class functions)
3
A property declaration (including class properties)
4
A constructor or destructor declaration
5
A visibility scope specifier (public, private, protected, published, strict private, and strict protected)
For example:
type
    TMyClass = class
      public
        class var        // Introduce a block of class static fields.
          Red: Integer;
          Green: Integer;
          Blue: Integer;
          procedure Proc1; // Ends the class var block.
    end;
The above class fields can be accessed with the code:
TMyClass.Red := 0;
TMyClass.Green := 0;
TMyClass.Blue := 0;
139


Methods
A method is a procedure or function associated with a class. A call to a method specifies the object (or, if it is a class
method, the class) that the method should operate on. For example, 
SomeObject.Free
 calls the 
Free
 method in
SomeObject
.
This topic covers the following material:
Methods declarations and implementation
Method binding
Overloading methods
Constructors and destructors
Message methods

Yüklə 0,84 Mb.

Dostları ilə paylaş:
1   ...   155   156   157   158   159   160   161   162   ...   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