我尝试在 C++ 中声明以下类;但是,我收到以下错误。指针有问题吗?
class classFather{
public:
int BmcCommand;
int BmcDataLength;
byte BmcDataBuffer[];
classFather() {
BmcCommand = 0;
BmcDataLength = 0;
BmcDataBuffer = new byte[CMD_LENGTHH];
}
classFather(byte s8Command, int siLength, byte as8Data[]) {
BmcCommand = s8Command;
BmcDataLength = siLength;
int size = sizeof( as8Data ) / sizeof( as8Data[0] );
BmcDataBuffer = new byte[size];
for(int ii=0; ii< size; ii++)
BmcDataBuffer[ii] = as8Data[ii];
}
private:
static const short CMD_LENGTHH = 255;
};
我收到以下错误:
error: incompatible types in assignment of `byte*' to `byte[0u]'
C:\....\BluetoothClient\/msgCAN.h: In constructor `msgCANFather::msgCANFather(byte, int, byte*)':