Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- Golang
- windows
- Linux
- http
- window
- go
- C
- c++
- Close
- 책
- 리뷰
- install
- mutex
- JavaScript
- range
- GO 언어
- Sync
- channel
- write
- bitcoin
- tcp
- Callback
- FOR
- go언어
- File
- API
- Python
- json
- package
- 영화
Archives
- Today
- Total
목록리시버 (1)
Code Habit
Go ) 구조체-메서드 연결 ( 클래스 )
Go 언어에는 클래스가 없는 대신 구조체에 메서드를 연결할 수 있다. func (변수명 *구조체타입) 함수명() 리턴값자료형 {} 1 2 3 4 5 6 7 8 9 10 11 12 13 14 type Rectangle struct { width int height int } func (rect *Rectangle) area() int { // rect : 구조체 변수 정의 (연결할 구조체 지정) return rect.width * rect.height // rect. : 구조체 변수를 사용하여 구조체에 접근할 수 있음 } func main() { rect := Rectangle{10, 20} fmt.Println(rect.area()) // 200 : Rectangle 구조체에 연결된 area() 함수를 ..
카테고리 없음
2020. 6. 2. 09:15