[go-nuts] Re: Struct overloading method issue

2017-09-01 Thread pierre . curto
Maybe I misunderstood your need, but I would just call the A method directly like below. type A struct{} func (a *A) private() {} func (a *A) Public() { a.private() } type B struct {A} func (b *B) private() { b.A.private() } bi := B{} b.Public() //calls the A.Private Le vendredi 1 s

[go-nuts] Re: Struct overloading method issue

2017-09-01 Thread BeaT Adrian
I solved it for now using composition and Constructors func NewA() { r := A{} r.private = privateForA } func NewB(){ r := B{} r.private = privateForB } I saw using constructors in a few builtin packages so I guess is ok. On Friday, September 1, 2017 at 5:50:52 PM UTC+3, BeaT Adrian w