Can operators in Smalltalk be overloaded?

前端 未结 5 751
你的背包
你的背包 2021-01-02 16:23

Is it possible to overload operators in Smalltalk?

I am looking for tutorials/examples.

Thanks.

5条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-02 17:04

    There's no operators in smalltalk, except assignment. Everything is implemented in classes as methods. So if you want to change behaviour of = or + / - methods, just look at their implementors. Or if you want to make instances of your class to understand those messages, just implement them.

提交回复
热议问题