struct st {
void printf(int n);
void printf(char c);
void printf(double d);
};
void main(void)
{
printf("global\n");
st aa;
aa.printf(5);
aa.printf('A');
aa.printf(3.14);
}
void st::printf(int n) {
::printf("%d\n", n);
}
void st::printf(char c) {
::printf("%c\n", c);
}
void st::printf(double d) {
::printf("%lf\n", d);
}
전역 변수나 함수의 이용은 ::를 붙여서 쓴다.
댓글 없음:
댓글 쓰기
국정원의 댓글 공작을 지탄합니다.