我有以下代码,我只希望前两种情况共享一个公共属性;但是,"id" conflicts with the declaration at line 11
当我尝试使用此语法时出现错误:
type Shape (Which : Shape_Type := SQUARE) is
record
case Which is
when Square =>
id : Natural; -- Line 11
when Turnout =>
id : Natural; -- Line that causes error to be thrown
when Invalid =>
null;
end case;
end record;