Skip to content

Commit

Permalink
✏️
Browse files Browse the repository at this point in the history
  • Loading branch information
H2Sxxa committed May 12, 2024
1 parent 14dfa9d commit b8ede7b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/_posts/oop_with_fp_via_method_chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ class Person:
person = Person().set_name("Reimu").set_age(16)
```

这就是方法链,这样的调用方法也就是链式调用!
像这样子调用一个方法之后返回自身实例继续调用自身方法就是方法链,这样的调用方法也就是链式调用!

# 不可变性

在方法链中返回一个新的实例而不是实例本身,这也就是不可变性,一旦值确定后就不对其更改。

大多数情况下你需要为你的类实现一下构造方法和复制方法,请看代码。
大多数情况下你需要为你的类实现一下复制方法,请看代码。

```python
from typing import Self
Expand Down

0 comments on commit b8ede7b

Please sign in to comment.