If I define a struct "A" and a method "Func" for ptr A
type A struct {}
func (a *A) Func() {}
Then I define another struct "C" embedded "A"
type C struct {
*A
}
Then new a C
c := new(C)
CFunc := reflect.ValueOf(c).MethodByName("Func")
AFunc := reflect.ValueOf(c.A).MethodByName("Func")
I think CFunc is equal to AFunc,
but how can I compare CFunc with AFunc?
If I new a "A"
ANewFunc := reflect.ValueOf(new(A)).MethodByName("Func")
I think ANewFunc is not equal to AFunc,
and how can I compare ANewFunc with AFunc?
Aucun commentaire:
Enregistrer un commentaire