simplefactory

package
v0.0.0-...-e059a18 Latest Latest
Warning

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

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

README

简单工厂模式

go 可以使用自定义的New()来初始化相关类。 New 函数返回接口时就是简单工厂模式,也是golang一般推荐做法。

simplefactory包中只有Mouth接口和New()函数可见。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mouth

type Mouth interface {
	Say(name string) string
}

Mouth is interface that people can Say words

func New

func New(t schoolmember) Mouth

New return instance object that have `Mouth` and can speak

Jump to

Keyboard shortcuts

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