Friends,
when i try to compile this program i am geting this error!!
ListMemoryFree.cpp: In member function 'void example::add(LinkSlcMap*)':
ListMemoryFree.cpp:41: error: 'm_link' was not declared in this scope
but to me it seems fine.:) plz point out my mistake!!
#include <iostream>
#include <list>
using namespace std;
struct LinkSlcMap
{
std::string mLinkName;
std::string mProfileName;
uint8_t slc;
bool linkInfo;
~LinkSlcMap()
{
printf("structure destructure called\n");
}
};
class example
{
public:
example(){}
~example();
void add(LinkSlcMap * link);
private:
list <LinkSlcMap *> m_Link;
};
example::~example()
{
printf("Class Destructure called\n");
LinkSlcMap *link;
list <LinkSlcMap *>::iterator it;
for(it=m_Link.begin();it!=m_Link.end();it++)
{
link = *it;
delete link;
}
void example::add(LinkSlcMap * link)
{
m_link.push_back(link);
}
int main()
{
example *ex = new example;
LinkSlcMap *link;
for(int i=0; i<5; i++)
{
link = new LinkSlcMap;
link->slc = i;
ex->add(link);
}
delete ex;
return 0;
}