You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

package main
import "fmt"

type RegularHuman struct {
}

func (RegularHuman) chill() {
	fmt.Println("Chilling..")
}

type Ninja struct {
	human RegularHuman
}

func (n Ninja) chill() {
	n.human.chill()
}

func (Ninja) attack() {
	fmt.Println("Throwing ninja stars")
}

type SeniorNinja struct {
	ninja Ninja
	human RegularHuman
}

func (sn SeniorNinja) attack() {
	sn.ninja.attack()
	fmt.Println("Swinging ninja swords")
	sn.human.chill()
}


  • No labels