I was coding a class for "a kind of gun". I have this code for the classes:
Gun.h:
#ifndef Gun_h
#define Gun_h
#include "Arduino.h"
class Gun
{
public:
Gun(String identifier, String name, int teamIRCodes[]);
String getIdentifier();
String getName();
int getIRCode();
private:
String _identifier;
String _name;
int _teamIRCodes[];
};
#endif
Gun.cpp:
#include "Arduino.h"
#include "Gun.h"
Gun::Gun(String identifier, String name, int teamIRCodes[])
{
_identifier = identifier;
_name = name;
_teamIRCodes = teamIRCodes;
}
String Gun::getIdentifier(){
return _identifier;
}
String Gun::getName(){
return _name;
}
int Gun::getIRCode(){
return _teamIRCodes[1];
}
It returns me this error while compiling:
sketch\Gun.cpp: In constructor 'Gun::Gun(String, String, int*)':
Gun.cpp:8: error: incompatible types in assignment of 'int*' to 'int [0]'
_teamIRCodes = teamIRCodes;
^
exit status 1
incompatible types in assignment of 'int*' to 'int [0]'