interface
Contents
1. what is
- is a type
- contain a set of method signature
2. used for
- 引入一个中间层,调用方和实现方解耦
3.type assertion vs type conversions
- assertion: 将interface 抓换为 具体类型
|
|
- conversions
4. compile time check
5. interface with pointer and value
- if methods receiver is value; then value and pointer implement the interface
for pointer, it could get value by dereference; then copy it;
|
|
- if methods receiver is pointer, then only pointer implement the interface
for value receiver, it could not get origin pointer;
|
|
todolist
- interface with compile time