Using a pointer or value target for methods not modifying the target in Go?

前端 未结 0 926
后悔当初
后悔当初 2020-12-02 02:33

It is required to use a pointer referenced target when a method modifies the target.

func foo(o *Object) bar() {
   ...
   code modifying the object o
   ...
         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题