有没有人知道一个很好的资源来解释何时object.method可以在ada中使用符号?
例如:
person.walk(10);
Run Code Online (Sandbox Code Playgroud)
我一直在做一些谷歌搜索,还没有想出来.它只适用于标记记录吗?
我使用GPS作为我的Ada IDE,我非常希望能够bla.<type something>获得建议的方法来调用.
我也有点困惑为什么点符号不能用于第一个参数匹配相关类型的任何东西.
谢谢
马特
从面向对象的范式思考,人们如何倾向于为标记记录实现私有属性?
从我可以看到的那一刻起,唯一的方法是拥有一个私有类型的属性.
例如
type car is tagged record
i_am_a_public_attribute : Integer;
i_am_another_public_attribute : Integer;
my_private_attributes : t_private_attributes;
end record;
Run Code Online (Sandbox Code Playgroud)
其中t_private_attributes在包的私有部分中声明.
我想到的第二种方法是使用继承,例如
type car_public is tagged record
i_am_a_public_attribute : Integer;
i_am_another_public_attribute : Integer;
end record;
type car_private is new car_public with record
my_private_attributes : Integer;
end record;
Run Code Online (Sandbox Code Playgroud)
其中car_private在包的私有部分中声明.虽然我觉得这个实现会非常混乱.
人们如何倾向于这样做?
谢谢马特