【发布时间】:2020-05-19 18:08:55
【问题描述】:
你好,我不知道我问清楚了没有。
我有一个延迟类“动物”,它包含两个特征:“咬”(返回布尔值 -> 咬:BOOLEAN)和“说话”(说话(字:布尔))。
现在我创建了一个名为“dog”的类,它继承自“animal”。我重新定义了这两个功能而没有编译器错误。现在我想做一个创建,其中包含函数咬(创建咬:BOOLEAN)。
这给了我一个编译器错误,如果我尝试使用其他功能它可以正常工作。
我的错误代码:VGCP(2) 创建者部分列出了不正确的标识符。
谢谢你的帮助
我的应用程序.e:
note
description : "root class of the application"
date : "$Date$"
revision : "$Revision$"
class
APPLICATION
inherit
ARGUMENTS_32
create
make
feature
d1:DOG
feature {NONE} -- Initialization
make
-- Run application.
do
print(d1.bite)
print ("Hello Eiffel World!%N")
end
end
我的动物班:
deferred class
ANIMAL
feature
bite_:BOOLEAN
deferred
end
feature
speak(word:BOOLEAN)
deferred
end
end
我的狗班:
class
DOG
inherit
ANIMAL
redefine
bite_,speak_
end
create
bite_
feature
bite_:BOOLEAN
do
Result:=5<3
end
feature
speak(word:BOOLEAN)
do
print("yes")
end
【问题讨论】:
-
请分享代码,以便我们确切知道您在说什么。
-
谢谢,我添加了一些示例代码
-
不清楚你为什么想让
create返回BOOLEAN。