_2_stateMethod

package
v0.0.0-...-a7c7adb Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	State       ActionState
	HealthValue int
}

func NewAccount

func NewAccount(health int) *Account

初始化

func (*Account) SetHealth

func (a *Account) SetHealth(value int)

给账户设定健康值

type ActionState

type ActionState interface {
	View()
	Comment()
	Post()
}

定义接口拥有不同的功能

type CloseState

type CloseState struct {
}

func (*CloseState) Comment

func (c *CloseState) Comment()

func (*CloseState) Post

func (c *CloseState) Post()

func (*CloseState) View

func (c *CloseState) View()

type NormalState

type NormalState struct {
}

func (*NormalState) Comment

func (n *NormalState) Comment()

func (*NormalState) Post

func (n *NormalState) Post()

func (*NormalState) View

func (n *NormalState) View()

type RestrictedState

type RestrictedState struct {
}

func (*RestrictedState) Comment

func (r *RestrictedState) Comment()

func (*RestrictedState) Post

func (r *RestrictedState) Post()

func (*RestrictedState) View

func (r *RestrictedState) View()

Jump to

Keyboard shortcuts

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