АС
Size: a a a
АС
PK
type Parent struct {и где-то
counter int
}
func (p *Parent) Tick() {
p.counter++
}
type Child struct {
Parent
extraCounter int
}
func (c *Child) Tick() {
c.Parent.Tick()
c.extraCounter++
}
type Ticker interface {
Tick()
}
с
Parent
? выглядит как глобалс
𝘀
DP
type Parent struct {и где-то
counter int
}
func (p *Parent) Tick() {
p.counter++
}
type Child struct {
Parent
extraCounter int
}
func (c *Child) Tick() {
c.Parent.Tick()
c.extraCounter++
}
type Ticker interface {
Tick()
}
PK
type Parent struct {и где-то
counter int
}
func (p *Parent) Tick() {
p.counter++
}
type Child struct {
Parent
extraCounter int
}
func (c *Child) Tick() {
c.Parent.Tick()
c.extraCounter++
}
type Ticker interface {
Tick()
}
DP
с
Parent
в Child
, то тогда c.Parent.Tick()
должно бытьDP
PK
с
extraCounter
должен бытьDP
type Parent struct {и где-то
counter int
}
func (p *Parent) Tick() {
p.counter++
}
type Child struct {
Parent
extraCounter int
}
func (c *Child) Tick() {
c.Parent.Tick()
c.extraCounter++
}
type Ticker interface {
Tick()
}
PK
PK
extraCounter
должен бытьDP
GC
PK
DP
GC