[C/C++]오버로딩과 오버라이딩의 차이
1.오버로딩: 함수를 같은 이름으로 파라메터 종류나 갯수만 다르게 정의함.
ex)
void fn(int a, int b);
void fn(float a, float b);
void fn(int a, int b, int c);
2.오버라이딩: 추상클래스의 맴버 가상함수를 함수의 이름과 파라메터 모두 같도록 정의함.
ex)
class Parent {
public:
virtual fn();
};
class Child :Parent {
public:
virtual fn();
};
댓글
댓글 쓰기