在playscence.h中
public:
//金币按钮数组
MyCoin *coinBtn[4][4];
void transCoin(MyCoin* [4][4],MyCoin *const &coin);
playscenve.cpp中
MyCoin *coin =new MyCoin(str);
coinBtn[i][j]=coin;
transCoin(coinBtn,coin);
void PlayScene::transCoin(MyCoin* [4][4],MyCoin *const &coin)
{
//......
}
下面是正确的传入参数形式(我不知道为啥这么写,就是莫名其妙就编译过了),我想问问这个形参都代表啥:
正确:
void PlayScene::transCoin(MyCoin* [4][4],MyCoin *const &coin)
void PlayScene::transCoin(MyCoin* [4][4],MyCoin *coin)
void PlayScene::transCoin(MyCoin*(*)[4] ,MyCoin *const &coin)
下面是错误的传入参数形式和报错
报错:
void PlayScene::transCoin(MyCoin* ,MyCoin *coin) //报错1
void PlayScene::transCoin(MyCoin* [4][4],MyCoin *&&coin) //报错1
void PlayScene::transCoin(MyCoin* ,MyCoin *const &coin) //报错3
void PlayScene::transCoin(MyCoin* [4][4],const MyCoin *&coin) //报错4
报错1:
报错2:
报错3:
报错4: