sách gpt4 ai đã đi

f# - 类型 'obj' 不是接口(interface)类型

In lại 作者:行者123 更新时间:2023-12-02 20:26:54 34 4
mua khóa gpt4 Nike

我有一个界面,在IAnimal.fs中,

namespace Kingdom
type IAnimal =
abstract member Eat : Food -> unit

以及另一个成功继承它的接口(interface),位于IMammal.fsở giữa.

namespace Kingdom
type IMammal =
inherit IAnimal

但是,当我尝试再次继承它时,出现异常 (IBird.fs)

namespace Kingdom
type IBird =
inherit IAnimal

异常(exception)情况是

The type 'obj' is not an interface type

The type 'IAnimal' is not defined

IAnimal hiện hữu IBird.fs 中在其下方有一条红线。

我尝试复制/粘贴 IMammal 的定义并将 IMammal 更改为 IBird 但仍然遇到相同的错误。还尝试重新启动 Visual Studio。

可能出了什么问题?

1 Câu trả lời

Make sure your files are in the correct order in your project. A file can only reference types and values defined in earlier fields. So in this case IMammal.fsIBird.fs must come after IAnimal.fs.

- TheQuickBrownFox

关于f# - 类型 'obj' 不是接口(interface)类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49253533/

34 4 0
Bài viết được đề xuất: cakephp - 为什么 saveAll() 只保存最后一条记录?
Bài viết được đề xuất: powerbi - 查询中无法识别电源双开关
Bài viết được đề xuất: kotlin - 如何在 kotlin 中打乱 HashMap
Bài viết được đề xuất: Haskell 导出记录仅供读取访问
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com