|
|
|
|
|
by sacado2
2198 days ago
|
|
You can only add methods on types that were defined in the current package. As a consequence, you can't add methods to built-in types. But that's rarely something you want to do anyway (I can't think of a real-world situation where it would be useful), what would make sense is creating a new string type, and add methods to it: type myInt int
func (mi myInt) f() myInt { ... }
|
|