2012-12-03 62 views
1

我得到的VDM ++工具箱學術一個愚蠢的錯誤。錯誤構造VDM ++

當我嘗試運行它給我這個錯誤的操作:

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的第一個字母。

有人可以幫助我嗎?

回答

0

如果我讀了你的模型正確,那麼它應該是這樣的描述:

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 

當我加入的測試和初始化的變量。

我看不出這裏有什麼問題,事實上它也運行在Overture這是其他開源工具套件VDM。我覺得你的規範是正確的VDM。給它的序曲IDE一試。