Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go Interface 合法验证 | 李斌的技术博客 #253

Open
jefferyjob opened this issue Aug 9, 2024 · 0 comments
Open

Go Interface 合法验证 | 李斌的技术博客 #253

jefferyjob opened this issue Aug 9, 2024 · 0 comments

Comments

@jefferyjob
Copy link
Member

https://blog.mailjob.net/posts/2809645964.html

接口实现判断依据 值方法集和接口匹配 给接口变量赋值的不管是值还是指针对象,都ok,因为都包含值方法集 指针方法集和接口匹配 只能将指针对象赋值给接口变量,因为只有指针方法集和接口匹配 如果将值对象赋值给接口变量,会在编译期报错(会触发接口合理性检查机制) 接口绑定 type Annimaler interface { Name() string } typ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant