This code has some objects representing a user and the admin who created that user. It's a trimmed down version of some code submitted to us by an applicant. The code is broken and deletes the admin when you try to delete the user (as demonstrated by main
). Why does u.Delete
call the admin's delete instead of the user's delete?
package admin
import "fmt"
type Admin struct {}
func (Admin) Delete() {
fmt.Println("deleting admin")
}
package user
import (
"fmt"
"admin"
)
type User struct {*admin.Admin}
func (*User) D