mirror of
https://gitee.com/shikong-sk/golang-study
synced 2025-02-23 15:32:15 +08:00
docs: 自定义类型、类型别名
This commit is contained in:
parent
e142f1f224
commit
78decca578
@ -5,6 +5,14 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 自定义 新类型
|
||||||
|
// 自定义类型 编译后 依然存在
|
||||||
|
type myInt int
|
||||||
|
|
||||||
|
// 类型别名
|
||||||
|
// 类型别名 编译后 定义的 类型别名将不存在 变为 别名对应的类型 只存在于代码中
|
||||||
|
type aliasInt = int
|
||||||
|
|
||||||
func f1() {
|
func f1() {
|
||||||
fmt.Println("exec f1()")
|
fmt.Println("exec f1()")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user