코딩 모닥불
  • 메뉴 닫기
  • 글작성
  • 방명록
  • 환경설정
    • 분류 전체보기
      • C++
      • 표준 라이브러리
      • 백준(BOJ)
  • 홈
  • 태그
  • 방명록
C++

[C++] 클래스 생성자의 멤버 초기화 리스트( member initializer list )

멤버 초기화 리스트( member initializer list )멤버 초기화 리스트는 클래스 생성자( constructor )의 매개변수 리스트 뒤에서 콜론 :으로 시작하는 데이터 멤버들의 초기화 목록입니다.그리고, 이 리스트의 각 멤버는 컴마 ,로 분리됩니다.다음 예문은 이러한 멤버 초기화 리스트를 보여주고 있습니다.class Date{ int m_year; int m_month; int m_day;public: Date( int year, int month, int day ) : m_year( year ), m_month{ month }, m_day{ day } // 멤버 초기화 리스트 { // do something } vo..

2025. 2. 20.
  • «
  • 1
  • »

전체 카테고리

  • 분류 전체보기
    • C++
    • 표준 라이브러리
    • 백준(BOJ)

블로그 인기글

태그

  • #std::string_view
  • #이진 탐색
  • #함수 객체
  • #예외 처리
  • #범위 기반 for
  • #헤더 가드
  • #동적 계획법
  • #decltype
  • #소멸자
  • #std::queue
  • #Enum
  • #std::stack
  • #std::vector
  • #상수 표현식
  • #전처리기
  • #std::unique_ptr
  • #std::sort
  • #Lamda
  • #constexpr
  • #const
  • #포인터
  • #깊이 우선 탐색
  • #inline
  • #using
  • #auto
  • #전방 선언
  • #namespace
  • #복사 생성자
  • #초기화
  • #static_cast
MORE
애드센스 광고 영역
Powered by Privatenote Copyright © 코딩 모닥불 All rights reserved. TistoryWhaleSkin3.4

티스토리툴바