Hi,
I'm a new arduino developer and I'm implementing my neural net libraries for the pololu robot.
I have a weird error when trying to use a class with an overloaded constructor.
Basically the .h looks like this:
// =====================================================================================
class NeuronBP
{
public:
// ==================== LIFECYCLE =========================================
/*! Constructor f,q */
NeuronBP(double f=DEF_F, double q=DEF_Q);
/*! Constructor void*/
NeuronBP();
....
}
and the c++ code looks like:
NeuronBP::NeuronBP(double f, double q)
{
reset();
normalize_ = true;
burst_ = false;
setFQ(f,q);
}
/** Constructor that sets frequency and quality.
*
* Constructor that sets frequency and quality.
*
* @param f double - The frequency.
* @param q double - The quality.
*
*/
NeuronBP::NeuronBP()
{
NeuronBP(NeuronBP::DEF_F,NeuronBP::DEF_Q);
}
The library is succesfully compiled and I can use it in this way:
void loop() // run over and over again
{
NeuronBP nrnbp(0.2,0.5);
for(double k=1.0;k<10.0;k=k+10.0)
{
nrnbp.calculate(k);
}
}
but when I try to use:
void loop() // run over and over again
{
NeuronBP nrnbp();
for(double k=1.0;k<10.0;k=k+10.0)
{
nrnbp.calculate(k);
}
}
The compiler says:
In function 'void loop()':
error: request for member 'calculate' in 'nrnbp', which is of non-class type 'NeuronBP ()()
it seems it considers two classes within the 2 different constructors.
Is it because i can't use overloading in classes?