没有重载函数可以转换所有参数类型


#include 
using namespace std;

class Student
{
public:
    Student(char* pName)
    {
        cout << "call one parameter constructor" << endl;
        strncpy_s(name, pName, sizeof(name));
        name[sizeof(name) - 1] = '\0';
        cout << "the name is" << name << endl;
    }
    Student(){ cout << "call no parameter constructor" << endl; }
    void display()
    {
        cout << "the name of the student is" << name << endl;
    }
protected:
    char name[20];
};

int main()
{
    static Student noName1;
    Student noName2;
    Student ss("Jenny");
    noName1.display();
    noName2.display();
    return 0;
}

http://t.csdn.cn/OLSvm
解决方法在这

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^