728x90
반응형
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// overloading on the c++ | |
// code from http://www.winapi.co.kr/ | |
#include <stdio.h> | |
#include <process.h> | |
class B | |
{ | |
public: | |
void f(int a) { puts("B::f(int)"); } | |
void f(double a) { puts("B::f(int)"); } | |
}; | |
class D : public B | |
{ | |
public: | |
void f(char *a) { puts("D::f(char *)"); } | |
}; | |
void main() | |
{ | |
D d; | |
d.f(""); // OK!! | |
d.f(1); // ERROR ( it's Invisible !!) | |
d.f(2.3); // ERROR | |
system( "pause" ); | |
} |
728x90
반응형
'C C++' 카테고리의 다른 글
Visual C++ 6.0 재배포 패키지(vc6redist)와 호환성 이슈 (0) | 2007.07.31 |
---|---|
[VA.C] example for variable number of arguments (0) | 2007.06.18 |
현재 윈도우즈 버전 얻기 예제 (0) | 2007.05.19 |
C++ 상수 포인터 (0) | 2007.05.17 |
최대한 잘라먹기(Maximal Munch)와 컴파일러(Compiler) (2) | 2007.05.16 |