actualCombat

package
v0.0.0-...-05962f3 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 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 AbstractComputer

type AbstractComputer interface {
	SetColor(color string)
	SetSize(size int)
	GetColor() string
	GetSize() int
}

定义电脑接口

type AbstractPhone

type AbstractPhone interface {
	SetColor(color string)
	SetSize(size int)
	GetColor() string
	GetSize() int
}

定义手机接口

type Computer

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

func (*Computer) GetColor

func (s *Computer) GetColor() string

func (*Computer) GetSize

func (s *Computer) GetSize() int

func (*Computer) SetColor

func (s *Computer) SetColor(color string)

func (*Computer) SetSize

func (s *Computer) SetSize(size int)

type InterfaceElectronicFactory

type InterfaceElectronicFactory interface {
	MakePhone() AbstractPhone
	MakeComputer() AbstractComputer
}

电子产品工厂

func GetElectronicFactory

func GetElectronicFactory(brand string) (InterfaceElectronicFactory, error)

获取电子产品工厂对象

type LenovoComputer

type LenovoComputer struct {
	Computer
}

联想电脑

type LenovoFactory

type LenovoFactory struct {
}

联想品牌工厂

func (*LenovoFactory) MakeComputer

func (n *LenovoFactory) MakeComputer() AbstractComputer

生产电脑

func (*LenovoFactory) MakePhone

func (n *LenovoFactory) MakePhone() AbstractPhone

生产手机

type LenovoPhone

type LenovoPhone struct {
	Phone
}

联想手机

type Phone

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

func (*Phone) GetColor

func (s *Phone) GetColor() string

func (*Phone) GetSize

func (s *Phone) GetSize() int

func (*Phone) SetColor

func (s *Phone) SetColor(color string)

func (*Phone) SetSize

func (s *Phone) SetSize(size int)

type XiaomiComputer

type XiaomiComputer struct {
	Computer
}

小米电脑

type XiaomiFactory

type XiaomiFactory struct {
}

小米品牌工厂

func (*XiaomiFactory) MakeComputer

func (a *XiaomiFactory) MakeComputer() AbstractComputer

生产电脑

func (*XiaomiFactory) MakePhone

func (a *XiaomiFactory) MakePhone() AbstractPhone

生产手机

type XiaomiPhone

type XiaomiPhone struct {
	Phone
}

小米手机

Jump to

Keyboard shortcuts

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