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 |
Tags
- Golang
- bitcoin
- http
- window
- windows
- c++
- package
- tcp
- write
- channel
- go
- Sync
- Callback
- Close
- 영화
- FOR
- 책
- Linux
- go언어
- JavaScript
- C
- range
- install
- File
- Python
- API
- json
- mutex
- GO 언어
- 리뷰
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