본문 바로가기

Code Habit

검색하기
Code Habit
프로필사진 코드베어

  • 분류 전체보기 (203)
Guestbook
Notice
Recent Posts
Recent Comments
Link
«   2025/05   »
일 월 화 수 목 금 토
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
  • windows
  • C
  • GO 언어
  • FOR
  • bitcoin
  • c++
  • mutex
  • channel
  • Sync
  • tcp
  • Linux
  • JavaScript
  • API
  • Close
  • Golang
  • Callback
  • window
  • go
  • Python
  • install
  • go언어
  • write
  • 책
  • json
  • File
  • 리뷰
  • http
  • 영화
  • package
  • range
more
Archives
Today
Total
관리 메뉴
  • 글쓰기
  • 방명록
  • RSS
  • 관리

목록리시버 (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
이전 Prev 1 Next 다음

Blog is powered by kakao / Designed by Tistory

티스토리툴바