dimanche 8 mars 2015

What is Causing this STATUS_ACCESS_VIOLATION?


I suck at c++ so i suspect it's a dumb mistake I have made. After a bit of research I see that that STATUS_ACCESS_VIOLATION happens when the program tries to access invalid memory blocks. That said I'm not seeing what is causing that to happen in the code below.



int main() {
cout << "!!!Hello World!!!" << endl;
Node* testNode = new Node("jhon","doe", 1, 80);
BraidedLinkedList* testList = new BraidedLinkedList();
testList->AddNode(testNode);
return 0;}


BraidedLinkedList.cpp



void BraidedLinkedList::AddNode(Node *newNode) {
if (this->start == NULL) {
this->start = newNode;
cout<<newNode->getInfo();
//the following line does not work either
//cout<<this->start->getInfo()<<endl;
}


Node.cpp



const string& Node::getInfo() {
string returnString = "";
returnString += this->getFristName() + " ";
returnString += this->getLastName() + " ";
returnString += this->getId() + " ";
returnString += this->getGrade() + " ";
}



Aucun commentaire:

Enregistrer un commentaire