浏览 196
分享
Pointers to Interfaces
You almost never need a pointer to an interface. You should be passinginterfaces as values—the underlying data can still be a pointer.
An interface is two fields:
- A pointer to some type-specific information. You can think of this as"type."
- Data pointer. If the data stored is a pointer, it’s stored directly. Ifthe data stored is a value, then a pointer to the value is stored.If you want interface methods to modify the underlying data, you must use apointer.
评论列表