struct_method_and_func_field

package
v0.0.0-...-f59f4bf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type M

type M struct {
	// contains filtered or unexported fields
}

func (*M) Method

func (m *M) Method()

方法则不一样,可以直接获得M的实例:m

type M1

type M1 struct {
	// 此时,函数参数类型是*M1
	F func(*Self)
}

如果结构体定义支持Self特殊结构,表示结构体自身实例

type M2

type M2 struct {
	Clone func(*M2) *M2
	Copy  func(M2) M2

	OtherPtr *M2 // 使用指针可以

	Other Self // 但只是想使用值呢?
}

type Self

type Self = any // 当成为语言特性后,不需要此定义

如果结构体定义支持Self特殊结构,表示结构体自身实例

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL