Hey there I am new to Object oriented programming in C++ (coded in Java) and I have some questions regarding it.
I have a two methods
void Manager::generate(){
// Generate robot basis
Matrix4 robotBasis = generateRobotBasis();
// Create Human
LinkedList * ll = new LinkedList();
createLL(ll);
Node *j = ll->GetRoot();
std::cout << j << "\n";
j = j->pChild_;
std::cout << j << "\n";
...
}
void Manager::createLL(LinkedList * ll){
Node node();
ll->InsertRoot(&node);
Node node2();
ll->InsertChild(&node, &node2);
Node node3();
ll->InsertChild(&node2, &node3);
Node *j = &node;
std::cout << j << "\n";
j = j->pChild_;
std::cout << j << "\n";
j = ll->GetRoot();
std::cout << j << "\n";
j = j->pChild_;
std::cout << j << "\n";
}
Results:
00ABF540
00ABF498
00ABF540
00ABF498
00ABF540
00CB83A8
The last column should be 00ABF498
? But turns out to be some random memory address.