Go 代码Example

124 阅读1分钟

结构体

实例化

ring := new(Ring) new 是内置方法,返回的是 对象的引用。

new方法介绍

// The new built-in function allocates memory. The first argument is a type,
// not a value, and the value returned is a pointer to a newly
// allocated zero value of that type.
func new(Type) *Type