【发布时间】:2021-01-04 14:24:02
【问题描述】:
我想创建一个 HASH_TABLE 的派生类,它实现了一些附加功能。我尝试这样实现它:
class HASH_TABLE2[G->HASHABLE]
inherit
HASH_TABLE[G,G]
rename
make as make_2
end
create
make
feature
make (capacity_ : INTEGER)
do
make_2(capacity_)
end
end
我收到此错误:
Error: Creation instruction uses call to improper feature.
Feature name: make_2 (n: INTEGER_32)
Line: 1156
do
-> create Result.make (n)
if object_comparison then
我不明白为什么。如果我对继承 ARRAY[G] 做同样的事情,那么它工作正常。
【问题讨论】:
标签: inheritance eiffel