compiler-errors - 构造函数VDM++中的错误

我在VDM++ ToolBox Academic中遇到一个愚蠢的错误。

当我尝试运行操作时,出现以下错误:

Run-Time Error 280: No constructor with this parameter list is in scope
value: "Game"

我的构造函数是:
public Game: Date * Team * Team ==> Game
Game(d,t1,t2) == (
    matchday := d;
    host := t1;
    visitor := t2;
    return self;
);

我在这里称呼它:
game := new Game(matchday1day1,groupA.teams(2),groupA.teams(3));

我有这个声明:
public groupA : Group;
public matchday1day1 : Date;

和(在组中):
public teams : seq of Team;

错误指向Game的第一个字母。

有人能帮我吗?

最佳答案

如果我正确阅读了您对模型的描述,那么它应该看起来像这样:

class Group

instance variables
public teams : seq of Team := [new Team(),new Team(),new Team()];
end Group

class Team
end Team

class Date
end Date

class Game

instance variables
matchday: Date;
host : Team;
visitor : Team;

operations
public Game: Date * Team * Team ==> Game
Game(d,t1,t2) == (
    matchday := d;
    host := t1;
    visitor := t2;
    return self;
);
end Game

class Test
instance variables

public groupA : Group := new Group();
public matchday1day1 : Date := new Date();

operations

public test : ()==>()
test()== (
dcl game : Game;
 game := new Game(matchday1day1,groupA.teams(2),groupA.teams(3)) ;
)

end Test

我在哪里添加了Test并初始化了变量。

我在这里没有发现任何错误,实际上它也可以在Overture中运行,后者是VDM的另一个开源工具套件。我认为您的规范是正确的VDM。在Overture IDE中尝试一下。

https://stackoverflow.com/questions/13685863/

相关文章:

compiler-errors - 虽然放在mingw文件夹中,但找不到包含的库头文件

sdk - CUDA 5.0 : checkCudaErrors fails to find cor

function - 数组被错误地称为子或函数

compiler-errors - sun.misc.InvalidJarIndexExceptio

android - Android “The specified child already has

android - 在Android版Eclipse中使用新版本的开发工具等时出错

c# - EF5十进制类型映射的奇怪编译器错误

objective-c - XCode 4.5中的工作区/编译/库问题,试图集成Box2DCocos

actionscript-3 - SimpleButton中的自定义Flash组件导致编译器错误

macos - 在Xcode中使用FreeImage