A: It is a variant record in Delphi. Variant records allow for different types to occupy the same space (but not at the same time, of course). The space allocated will be as large as the largest possible variation, but there need be no needless duplication of memory allocated. This is how a variant record is declared:
purchase = record
amount: real;
{more stuff}
case MethodOfPayment of
check: (check number: integer;
checkAmt: real;
LicenseNumber: string[20]);
CreditCard:(card: CardType;
ExpMonth: 1..12;
ExpYear: YearType);
end;
end;
Unions in Delphi/Pascal are not a reserved word as much as an operator. Here is how a union (Pascal style) is done:
var
a, b, c: set of char;
begin
a := ['a'..'z'];
b := ['a', 'c', 'e', 'g'];
c := ['a'..'d', 'z'];
if a - b = ['b', 'd', 'f', 'h'..'z'] then
blah; {difference}
if b + c = ['a'..'d', 'e', 'g', 'z'] then
blah; {union}
if b * c = ['a', 'c'] then
blah; {intersection}
end;