相关疑难解决方法(0)

为什么 Ada 中不允许匿名访问对象之间的隐式转换?

我正在阅读 Barnes 的书“Programming in Ada 2012”。这是实现第 12.5 节中的堆栈的代码示例。

src/stacks.adb:(主要相关文件)


package body Stacks is

   procedure Push(S: in out Stack; X: in Integer) is
   begin
      S := new Cell'(S,X);
   end Push;

   procedure Pop(S: in out Stack; X: in out Integer) is
   begin
      X := S.Value;
      S := Stack(S.Next);
   end Pop;

   function "="(S, T: Stack) return Boolean is
      SS: access Cell := S;
      TT: access Cell := T;
   begin
      while SS /= null and TT /= null loop
         if SS.Value /= TT.Value then …
Run Code Online (Sandbox Code Playgroud)

operator-overloading ada

6
推荐指数
0
解决办法
334
查看次数

标签 统计

ada ×1

operator-overloading ×1