我收到一个错误,我找不到任何文档来解释我的代码中需要修复的内容。代码是:
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;
我得到的错误是declaration of full view must appear in private part
。它将此错误指向行type BinarySearchTreePoint is access Node;
,并且我不确定错误消息的含义。
答案 0 :(得分:5)
当您说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;
...
但是如果你需要在包裹外面看到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;
...