我正在尝试从一个类中打印一些数据,并且它打印得很好,直到他达到整数然后抛出一个堆损坏错误。谁能向我解释为什么会这样做?
void Skill::Display(ostream& out){
char* myName = getName();
char* myDescription = getDescription();
int myLevel = getLevel();
out << " - " << myName << " -- " << myDescription << "[Lvl: ";
out << myLevel << "]" << endl; //Everything up to here is fine
}//breakpoint here and it gives me heap error.
我不明白为什么打印 int 会导致堆错误。