Questions tagged «explicit-constructor»

11
C ++弃用了从字符串常量到'char *'的转换
我有一堂课 private char str[256]; 为此,我有一个显式的构造函数: explicit myClass(const char *func) { strcpy(str,func); } 我称其为: myClass obj("example"); 当我对此进行编译时,会收到以下警告: 从字符串常量到'char *'的弃用转换 为什么会这样呢?

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.