Hi,
I have
class Node
{
public:
string el1;
string el2;
string curr;
string name;
int ID1;
int ID2;
Node(){
//constructor is here
ID1=-1;
ID2=-1;
}
};
And it has 10 different nodes represented with array..
Node [] allNode=new Node[10];
for(i=0; i< 10; i++)
{
//create new node
allNode[i] = new Node();
std::string el = "f";
std::string el2 = "g";
std::string allNode[i].curr;
allNode[i].curr = name + boost::lexical_cast<std::string>(i);
cout << "Node name " << allNode[i].curr <<endl;
}
However, I have compile error as below:-
error: expected unqualified-id before ‘[’ token referring to Node [] allNode=new Node[10];
error: ‘allNode’ was not declared in this scope
error: ‘name’ was not declared in this scope
Please advise. Thanks.