lpcware

Problem With Class

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by Italia on Wed Jul 30 03:49:11 MST 2014
Hi,

i wrote this easy code in mt LPC2468 CPU:

/*
===============================================================================
Name        : $(Module).cpp
Author      : $(author)
Version     :
Copyright   : $(copyright)
Description : $(Module) definition
===============================================================================
*/

// TODO: insert include files here
//#include "RFIDREADER.cc"
// TODO: insert other definitions and declarations here

class My_Class
{
public:
My_Class(void);
unsigned int somma(unsigned int a, unsigned int b);
private:
unsigned int risultato;
};

My_Class::My_Class(void)
{
unsigned int i;
for(i=0;i<10;i++)
{
risultato=somma(i,i);
}
}
unsigned int My_Class::somma(unsigned int a, unsigned int b)
{
return (a+b);
}

My_Class first;

int main(void) {

// TODO: insert code here
//RFIDReader RF = new RFIDReader;
// force the counter to be placed into memory
volatile static int i = 0 ;

// Enter an infinite loop, just incrementing a counter
while(1)
i++;
return 0 ;
}

Now, when i put a breakpoint in the for cycle, the degugger never pass in
the cycle, so the object is not initialized. I wont to ask the reason and the possible solution. P.s i already try to define this class in the main loop and
in this case eserithing is well!

Outcomes