Reputation: 2093
Here's an example (which is not working):
type
menu = class
private
menu_element = RECORD
id: PtrUInt;
desc: string;
end;
public
procedure foo();
end;
Upvotes: 5
Views: 2117
Reputation: 26358
Free Pascal accepts this if you change the "=" to a ":". Fields are declared with ":", types with "="
{$mode Delphi}
type
menu = class
private
menu_element : RECORD
id: PtrUInt;
desc: string;
end;
public
procedure foo();
end;
procedure menu.foo;
begin
end;
begin
end.
Turbo Pascal and Delphi (and FPC's before 2.2) forbid this. Free Pascal reinstated this old (Classic Pascal) behaviour because of Apple dialects.
Upvotes: 3
Reputation: 1921
Yes you can. But since you want to declare a type, you must type a valid type expresssion
type menu = class
private
type menu_element = RECORD
id: PtrUInt;
desc: string;
end;
end;
Upvotes: 5