問題發生在我的ToDoList.cpp類文件中。無效的從'int'轉換爲'const char *'問題C++
ToDoList.cpp:
ToDoList::ToDoList() {
arraySize = 3;
arrayData = 0;
array = new string(arraySize); //error here
}
ToDoList::ToDoList() {
array = new string(todolist.arraySize); //and error here
arraySize = todolist.arraySize;
arrayData = todolist.arraySize;
}
ToDoList.h:
class ToDoList {
public:
ToDoList();
ToDoList(const ToDoList&);
~ToDoList();
void AddItem(string item);
void ListItems();
private:
string* array;
int arraySize;
int arrayData;
};
你想新的字符串[todolist.arraySize(); – Ben