多参数
if there are多参数,C + +应用the匹配规则in turn to each的论点功能选择是the onefor which each辩论比赛at least as well as all the other功能,以及至少一参数匹配比所有其他功能换句话说,选择功能必须提供更好的比赛比所有其他候选人functions for at least one参数,与没有worse for all of the other参数
in the case that such a function is found,it is clearly and unambiguously最好的选择如果没有这样的功能can be found,the call will be consideredambiguous(或不匹配)
结论
功能的CAN overloading下有程序复杂性significantly引入非常小额外的风险虽然这份课程是长期的和可能似乎稍微复杂(特别是the匹配规则),在现实的功能overloading transparently and without any从通常的作品the编译将旗全ambiguouscases,and they generally be easily ADC分辨
thanks for the注你已经注意到了,the number of测验问题和练习瀑布下significantly你去through the教程The reason for this is简单:他们花时间写,especially as we get into更复杂的人
给出了有限的时间to work on this I decided There was more网站,benefit to支出我的时间写作主体教程比提问的问题一旦你做教程(which实际上那不是遥远的Now),我想要go back and add more测验问题和练习
我了解类型char *的是什么?
我从C代码如–看到一个不同的例子
char *动物=“狗”;//这创造了一个指针(称为动物)为字符串“狗”。
如果我们有–
定义字符串类型;
然后我们可以
字符串的动物“狗”;
这将是一样的
char *动物=“狗”;
[是的。亚历克斯。
就是上面真的因为指针数组同样如此
char *动物=“狗”;
真的是一样的
char动物[] =“狗”;
这typdef–后
typdef字符串;
这是现在也是—
字符串的动物“狗”;
[是的,然而,一个指针是不是一个数组一样。在C++中使用指针数组。但是,它是可能的(共同)有指针指向数组的所有东西都不是