Hello :)
well as the title says, i have a problem with casting to void*.
so, I made a linked list class at c++. heres the list :
class LinkedList
{
struct LinkedListObjec t
{
void* data;
LinkedListObjec t *nxt_obj;
}*list_head;
void AddObj(void* data);
}
So, at the AddObj function, I have a little problem. thats the function:
void LinkedList::Add Obj(void* data)
{
LinkedListObjec t *object;
if(list_head==N ULL)
{
object->data=data;
object->nxt_obj=NULL ;
list_head=objec t;
return;
}
...
}
when i try to use the function on other class, i mean when im trying to add an object to the list , the program shut down at the line object->data=data.
for example:
Location l; (Location is a class at my prog)
...
list.AddObj(&l) .
as I said the program shut down at the line object->data=data..
help?
well as the title says, i have a problem with casting to void*.
so, I made a linked list class at c++. heres the list :
class LinkedList
{
struct LinkedListObjec t
{
void* data;
LinkedListObjec t *nxt_obj;
}*list_head;
void AddObj(void* data);
}
So, at the AddObj function, I have a little problem. thats the function:
void LinkedList::Add Obj(void* data)
{
LinkedListObjec t *object;
if(list_head==N ULL)
{
object->data=data;
object->nxt_obj=NULL ;
list_head=objec t;
return;
}
...
}
when i try to use the function on other class, i mean when im trying to add an object to the list , the program shut down at the line object->data=data.
for example:
Location l; (Location is a class at my prog)
...
list.AddObj(&l) .
as I said the program shut down at the line object->data=data..
help?
Comment