일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Data Structure
- c#
- dart 언어
- gitlab
- 구조체
- Python
- HTML
- Unity
- c# 윈폼
- C++
- Algorithm
- 포인터
- 도커
- vim
- Houdini
- C언어 포인터
- jupyter lab
- git
- c# winform
- 유니티
- 깃
- C# delegate
- c# 추상 클래스
- 플러터
- Flutter
- github
- docker
- 다트 언어
- c언어
- jupyter
Archives
- Today
- Total
05-15 02:05
목록c++ 동적 바인딩 (1)
nomad-programmer
[Programming/C++] 가상 함수를 사용한 다형성의 구현
언제 가상 함수가 필요할까? 가상 함수의 필요성을 알아보려면 소스 코드를 보는 것이 가장 좋다. 다음의 예제를 보자. #include using namespace std; class Shape{ public: void Move(double x, double y); void Draw() const; Shape(); Shape(double x, double y); protected: double _x, _y; }; Shape::Shape(): _x(0), _y(0) {} Shape::Shape(double x, double y): _x(x), _y(y) {} void Shape::Move(double x, double y){ _x = x; _y = y; } void Shape::Draw() const{ cout
Programming/C++
2023. 1. 21. 00:02