Variant parts in records

Top  Previous  Next

What is translated > Types > Records, Classes, Interfaces > Record > Variant parts in records

 

There is only a makeshift to treat variant parts in records: For every case there is created an according union in C++.

 

 

  TRect = packed record

    case Integer of

      0: (Left, Top, Right, Bottom: Longint);

      1: (TopLeft, BottomRight: TPoint);

  end;

 

  ->

 

#pragma pack(push, 1)

struct TRect {

  /*# case Integer */

  union {

    /*# 0 */

    struct {

    int Left, Top, Right, Bottom;

    };

    /*# 1 */

    struct {

    TPoint TopLeft, BottomRight;

    };

  }; //union

};

#pragma pack(pop)

 

 



This page belongs to the Delphi2Cpp Documentation

Delphi2Cpp home  Content