带缺省参数的重复声明

char *screenInit(int height, int width, char background = ' ');
char *screenInit(int height = 4, int width = 4, char background);

正确;

char *screenInit(int height, int width, char background = ' ');
char *screenInit(int height = 4, int width = 4, char background = ' ');//redefinition of default parameter : parameter 3

错误;缺省参数不能重定义;

void manip(int (*arr)[5], int size);
void manip(int (*arr)[2], int size);

可以,但是被当做是重载函数, 根据传递的参数 选择执行哪个函数

posted @ 2011-07-23 22:23  lidan  阅读(260)  评论(0编辑  收藏  举报