[fpc-pascal] Case in Record

章宏九 secludedsage at gmail.com
Tue Oct 6 15:13:21 CEST 2009


In the document
(http://www.freepascal.org/docs-html/ref/refsu15.html#x38-450003.3.2)
I read the code below:

Type
  MyRec = Record
          X : Longint;
          Case byte of
            2 : (Y : Longint;
                 case byte of
                 3 : (Z : Longint);
                 );
          end;

I still cannot understand what do these two "byte" mean. I have
difficulty in understanding "The optional identifier in the case
statement serves to access the tag field value, which otherwise would
be invisible to the programmer" and need some explain. Thank you.

Another problem is about Object and Class. I notice that in wiki
(http://wiki.freepascal.org/Object_Oriented_Programming_with_FreePascal_and_Lazarus),
Class is explained as a pointer to the structure, while Object returns
the whole structure. And the wiki said that Object is not used very
much. Does this mean that Object is deprecated? Can Objects contain
any properties?



More information about the fpc-pascal mailing list