mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-30 04:44:44 +00:00
Updata commit hash
This commit is contained in:
parent
1d71d8b405
commit
b0ea54cbb0
1 changed files with 4 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
# Class
|
||||
|
||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/04_class.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258)
|
||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/04_class.md&commit_hash=1ae76335017dda8c599203146232956aa8b5b73e)
|
||||
|
||||
Erg 中的类大致是一种可以创建自己的元素(实例)的类型。
|
||||
这是一个简单类的示例。
|
||||
|
@ -243,9 +243,9 @@ print! c # <C object>
|
|||
c == d # 类型错误:`==` 没有为 `C` 实现
|
||||
|
||||
D = Inherit {i = Int}
|
||||
e = D.new {i = 1}
|
||||
f = D.new {i = 2}
|
||||
print! e # D{i = 1}
|
||||
e = D::{i = 1} # 与`e = D.new {i = 1}`相同
|
||||
f = D::{i = 2}
|
||||
print! e # D(i=1)
|
||||
assert e ! = f
|
||||
```
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue