[Go] Updated the 'callback' and 'extend' examples to match the 'director' one.
After the documentation update on how to utilize the director feature with
commit @17b1c1c the 'callback' and 'extend' examples needed an update as well.
This commit is contained in:
parent
a941e5b605
commit
85037c3a33
12 changed files with 130 additions and 100 deletions
37
Examples/go/extend/ceo.go
Normal file
37
Examples/go/extend/ceo.go
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
package example
|
||||
|
||||
type CEO interface {
|
||||
Manager
|
||||
deleteManager()
|
||||
IsCEO()
|
||||
}
|
||||
|
||||
type ceo struct {
|
||||
Manager
|
||||
}
|
||||
|
||||
func (p *ceo) deleteManager() {
|
||||
DeleteDirectorManager(p.Manager)
|
||||
}
|
||||
|
||||
func (p *ceo) IsCEO() {}
|
||||
|
||||
type overwrittenMethodsOnManager struct {
|
||||
p Manager
|
||||
}
|
||||
|
||||
func NewCEO(name string) CEO {
|
||||
om := &overwrittenMethodsOnManager{}
|
||||
p := NewDirectorManager(om, name)
|
||||
om.p = p
|
||||
|
||||
return &ceo{Manager: p}
|
||||
}
|
||||
|
||||
func DeleteCEO(p CEO) {
|
||||
p.deleteManager()
|
||||
}
|
||||
|
||||
func (p *ceo) GetPosition() string {
|
||||
return "CEO"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue