65,211
社区成员
发帖
与我相关
我的任务
分享
//--------版本1-------------
//button 是一个class
Button* b[3];
void MainWindow::bh0(){
std::printf("button_0 pressed\n");
destoryButton(b[1]);
}
void MainWindow::destoryButton(Button* b)
{
if (b!=NULL){
delete b;
b = NULL;
}
}
//------版本2------------
//button 是一个class
Button* b[3];
void MainWindow::bh0(){
std::printf("button_0 pressed\n");
if(b[1]!=NULL){
delete b[1];
b[1] =NULL;
}
}
void MainWindow::destoryButton(Button*& b)