英文:
How to initialise an abstract in Julia?
问题
Julia> abstract Shape
ERROR: 语法: 表达式结束后的额外标记 "Shape"
Stacktrace:
[1] top-level scope at REPL[64]:0
只想创建一个抽象,但即使使用帮助,它也会显示以下内容>
是否有任何替代方法?
help?> abstract
search: AbstractSet abstract type AbstractChar AbstractDict AbstractFloat
找不到抽象
也许你想要的是 struct 或 AbstractSet
没有找到文档。
绑定 abstract 不存在。
英文:
Julia> abstract Shape
ERROR: syntax: extra token "Shape" after end of expression
Stacktrace:
[1] top-level scope at REPL[64]:0
Just wanted to create an abstract but it says following even when I use help?>
Is there any alternate to this?
help?> abstract
search: AbstractSet abstract type AbstractChar AbstractDict AbstractFloat
Couldn't find abstract
Perhaps you meant struct or AbstractSet
No documentation found.
Binding abstract does not exist.
答案1
得分: 4
正确的语法是 abstract type Shape end
。
您可以在 REPL 帮助模式下通过完整的关键字查找文档:
help?> abstract type
关于该关键字的在线文档以及关于类型的更一般性文档也可供参考。
英文:
The correct syntax is abstract type Shape end
.
You can find the docs in the REPL help mode with the full keyword:
help?> abstract type
There is online documentation on the keyword and more general documentation on types.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论