Go 구조체 필드

Jmnote (토론 | 기여)님의 2021년 4월 9일 (금) 10:43 판
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

개요[ | ]

Struct Fields in Go
Go 구조체 필드
  • 구조체 필드는 점(.)을 사용하여 접근한다.
// https://tour.golang.org/moretypes/3
package main

import "fmt"

type Vertex struct {
	X int
	Y int
}

func main() {
	v := Vertex{1, 2}
	v.X = 4
	fmt.Println(v.X)
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}