本文介绍了如何在Ada中实现继承以及它是否已在GUI中构建?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Ada是否带有内置GUI,它与Oberon具有相同的唯一继承方法吗?

Does Ada come with built-in GUI, and does it have the same unique approach to inheritance as does Oberon?

推荐答案

否,Ada没有内置GUI。但是我能想到的最接近的语言是PostScript。 (从技术上讲,Java语言没有;尽管它包含的库​​也有。)也就是说,有一个GTK绑定(我根本没有使用过)和一个OpenGL绑定(我只玩过;并且老实说,OpenGL绑定比我想要的要薄得多。)

No, Ada does not come with a built-in GUI; but then the closest language that I can think of is PostScript. (Technically, the Java-language does not; though its included library does.) That being said there is a GTK binding (which I haven't used at all) and an OpenGL binding (that I've only played with; and to be honest the OpenGL binding is far thinner a binding than I'd like).

Oberon的继承模型(据我了解)是单扩展继承,与艾达尽管Ada确实集成了类似于Java的接口系统。我尚未真正使用过Oberon,因此我无法真正为您提供这两个的并排示例,但可以向您展示Ada的示例。

Oberon's inheritance model (as I understand) is single-extension inheritance which is the same as Ada; though Ada does incorporate an Interface system similar to Java. I haven't actually used Oberon, so I can't really provide you with a side-by-side examples for the two, but can show you an example of Ada's.

Base:

Type Base is Abstract Tagged Record
   Null;
End Record; -- Base

-- Base Operations
Procedure Op( Object : In Out Base );
Procedure Dispatching_Op( Object : In Out Base'Class );

扩展名:

Type Extended is New Base With Record
  Null;
End Record; -- Extended

Overriding Procedure Op( Object : In Out Extended );

具有以下内容的正文:

  Procedure Op( Object : In Out Base ) is
  begin
     Put( "Hello" );
  end Op;

  Procedure Dispatching_Op( Object : In Out Base'Class ) is
  begin
     Op( Object );
     Put_Line( " World." );
  end Dispatching_Op;

  Procedure Op( Object : In Out Extended ) is
  begin
     Put( "Goodbye" );
  End Op;

给定类型为P的对象{P:K.Base'Class:= K.Extended' (Others =><>);}可以这样称呼:

Which given an object of type P {P : K.Base'Class:= K.Extended'(Others => <>);} could be called like so:

P.Dispatching_Op;

在这种情况下会产生以下结果:

And would produce the following results in this instance:

Goodbye World.

这篇关于如何在Ada中实现继承以及它是否已在GUI中构建?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-19 04:56