composite

package
v0.0.0-...-7dcde51 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Example (One)
treasureChest := NewChest(TreasureChestType, nil)
goldenChest := NewChest(ChestOfChestType, treasureChest)
silverChest := NewChest(ChestOfChestType, goldenChest)
woodChest := NewChest(ChestOfChestType, silverChest)

fmt.Println(woodChest.Open())
Output:

[[[$]]]

Index

Examples

Constants

View Source
const (
	TreasureChestType = iota
	ChestOfChestType
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Chest

type Chest interface {
	Store(chest Chest)
	Open() string
}

func NewChest

func NewChest(kind int, holdings Chest) Chest

type ChestOfChest

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

func NewChestOfChest

func NewChestOfChest(holdings Chest) *ChestOfChest

func (*ChestOfChest) Open

func (p *ChestOfChest) Open() string

func (*ChestOfChest) Store

func (p *ChestOfChest) Store(chest Chest)

type TreasureChest

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

func NewTreasureChest

func NewTreasureChest(holdings Chest) *TreasureChest

func (*TreasureChest) Open

func (p *TreasureChest) Open() string

func (*TreasureChest) Store

func (p *TreasureChest) Store(chest Chest)

Jump to

Keyboard shortcuts

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