eph*_*ron 0 printing generics ada put
我目前正在尝试打印("Ada.Text_IO.Put")一个泛型类型,但这总是失败,出现这样的错误:
missing argument for parameter "Item" in call to "Put" declared at a-tiinio.ads:60, instance at a-inteio.ads:18
expected type "Standard.Integer"
found private type "My_Type" defined at testtype.ads:2
Run Code Online (Sandbox Code Playgroud)
这些错误是有道理的,但我不知道如何打印我的价值观.以下行显示了我的泛型类型.
generic
type My_Type is private;
with function "+"(Left: My_Type; Right: My_Type) return My_Type;
package TestType is
...
end TestType;
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助!
您可以要求另一个通用参数,例如:
with function image(Item : in My_Type) return String;
Run Code Online (Sandbox Code Playgroud)
然后只需打印Image功能输出的字符串.
实际参数的示例可能是:
image => Integer'Image
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1496 次 |
最近记录: |