method

package
v0.0.0-...-8479fe5 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Test1

func Test1()

Test1 .

func Test2

func Test2()

Test2 . 具体只跟方法的接收者相关,如果接受者为指针,调用者(t) 是值类型 Go 会自动转换 (&t).method() 可以通过指针接受者来修改一个结构体的外包不可见字段。

func Test3

func Test3()

Test3 类型 String() 方法和格式化描述 当为类型定义了 String 方法时,调用 print 方法会自动调用 该类型的 String 方法

func Test4

func Test4()

Test4 创建一个 employee 实例显示出它的ID

Types

type B

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

B .

type Base

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

Base .

func (Base) ID

func (b Base) ID() int

ID .

func (*Base) SetID

func (b *Base) SetID(id int)

SetID .

type Employee

type Employee struct {
	Person
	// contains filtered or unexported fields
}

Employee .

type Person

type Person struct {
	FirstName string
	LastName  string
	Base
}

Person .

Jump to

Keyboard shortcuts

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