일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Unity
- c# 윈폼
- gitlab
- 포인터
- vim
- C# delegate
- Houdini
- 다트 언어
- 유니티
- git
- dart 언어
- Data Structure
- c# winform
- 구조체
- docker
- 깃
- github
- Algorithm
- c# 추상 클래스
- jupyter
- jupyter lab
- 도커
- C언어 포인터
- c언어
- c#
- HTML
- C++
- Flutter
- 플러터
- Python
Archives
- Today
- Total
목록const 멤버 함수와 비 const 멤버 함수 (1)
nomad-programmer
[Programming/C++] const 멤버 함수와 비 const 멤버 함수
const 멤버 함수는 멤버 함수 내에서 객체의 멤버 변수를 변경하지 않는다는 것을 보장하는 함수이다. 따라서 const 객체는 const 멤버 함수만 호출할 수 있다. const 멤버 함수에서 멤버 변수를 변경하면 컴파일 에러가 발생한다. 사실 자신의 멤버를 변경하지 않는 멤버 함수는 모두 const 멤버 함수여야만 한다. 다음은 cosnt 멤버 함수 예제이다. class Point{ public: Point(int _x=0, int _y=0) : x(_x), y(_y) {} int GetX() const { return x; } int GetY() const { return y; } void SetX(int _x) { x = _x; } void SetY(int _y) { y = _y; } void P..
Programming/C++
2023. 1. 19. 15:47