АС
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