so i have 8 structures which will share
struct_name * next;
struct_name * prev;
pointers in it.
i wonder if i could create a base class like:
struct TLinkedListWay
{
TLinkedListWay * next;
TLinkedListWay * prev;
};
struct structure1 : public TLinkedListWay
{
char * name;
int name_len;
char * something_else;
int something_else_len;
};
struct structure2 : public TLinkedListWay
{
char * name;
int name_len;
char * something_else;
int something_else_len;
};
struct structure3 : public TLinkedListWay
{
structure1 * First_linked_list;
structure2 * Second_linked_list;
};
now structure3 is a base which holds pointers to first object of structure1 and structure2
but i am not sure when i will do:
inline TLinkedListWay * getLastEvent(TLinkedListWay * first_object)
{
TLinkedListWay * p = first_object;
while (p!= NULL) p = p->next;
return p;
}
this will point to the proper place in memory (consider i want to find last object of structure3 and then last object (in that structure of structure1) will this point properly?
do you even understand me? :/
i want to avoid creating separated functions like above for each structure, and i wonder if this could be managed like that, without any bugs like it would point on something else.