Jak*_*man 0 compiler-errors ada
我收到一个错误,我找不到任何文档来解释我的代码中需要修复的内容.代码是:
type BinarySearchTreePoint is limited private;
type Node;
type BinarySearchTreePoint is access Node;
type Node is
record
Llink, Rlink : BinarySearchTreePoint;
Ltag, Rtag : Boolean; --True indicates pointer to lower level,
-- False a thread.
Info : Customer;
end record;
Run Code Online (Sandbox Code Playgroud)
我得到的错误是declaration of full view must appear in private part.它抛出了指向该行的错误type BinarySearchTreePoint is access Node;,我不确定错误消息的含义.
当你说type Foo is private;(或limited private)你需要在私人部分提供完整的声明; 当然,这意味着你必须拥有私人部分.
您显示的代码将编译
package Foo is
type BinarySearchTreePoint is limited private;
private
type Node;
type BinarySearchTreePoint is access Node;
type Node is
record
Llink, Rlink : BinarySearchTreePoint;
...
Run Code Online (Sandbox Code Playgroud)
但如果你需要Node在包装外面看到,你需要说出类似的话
package Foo is
type BinarySearchTreePoint is limited private;
type Node is private;
-- stuff to do with getting a Node from a BinarySearchTreePoint??
function Content (Of_Node : Node) return Customer;
private
type BinarySearchTreePoint is access Node;
type Node is
record
Llink, Rlink : BinarySearchTreePoint;
...
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
124 次 |
| 最近记录: |