user3308043
user3308043

Reputation: 827

Pointer + LinkedList: Why am I getting this error?

I have a Queue class that holds a private LinkedList variable. The LinkedList holds DataItem pointers.

class Queue
{  
  private:

   LinkedList* someList;

...

The Queue then tries to add a DataItem using this Add method:

void Queue::addOne(DataItem* data)
{

  someList->add(data);

}

It is important to note that the LinkedList class works perfectly.

The program crashes spectacularly when it tries to add something to the Queue. What's going on?

Upvotes: 0

Views: 26

Answers (1)

NewbiZ
NewbiZ

Reputation: 2498

The question is very vague and the code is not representative... maybe you forgot to allocate someList...?

Upvotes: 2

Related Questions