この実装クラスの処理中に固まってしまいました。 以下は、g ++コンパイルを使用して私のコードを私のコードのようなエラーを与える私のコードです。C++のコンストラクタとメソッドの実装
Contact::Contact(const char * name, const char * address, const char *
tel) {
name = new char[strlen(name) + 1];
address = new char[strlen(address) + 1];
tel = new char[strlen(tel) + 1];
strcpy(this->name, name);
strcpy(this->address, address);
strcpy(this->tel, tel);
}
エラーが助けを
Contact.cpp:9: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x
感謝です!
char配列、newおよびstr *関数ではなく、std :: stringを使用します。 –
9行はどこですか? –
@ manni66これは9行目です。> name = new char [strlen(name)+ 1]; – joe