char three_let[13][4]={"emp","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};class Month{private:int month;bool check();public:Month(char x[3]); //別的函數(shù)我就不寫(xiě)了}Month::Month(char x[3]){int i;for (i=1; i<14; i++) {if ((strcmp(three_let[i], x)==0)) {month=i;break;}}}int main(){Month month3({'J','a','n'});這里總是報(bào)錯(cuò) 說(shuō)no matching constructor for initialization of 'Month'我改成Month month3("Jan"); 也不行說(shuō)ISO C++11 does not allow conversion from string literal to 'char'
為什么我改成Month month3("Jan"); 也不行?
狐的傳說(shuō)
2023-03-18 14:10:24