Date: Tue, 11 Jan 2000 09:50:19 +0200 (EET) Message-Id: <200001110750.JAA80114@openet.freenet.hut.fi> From: joh0 AT freenet DOT hut DOT fi (Jarno Honkanen) To: djgpp AT delorie DOT com Subject: Template problem Reply-To: djgpp AT delorie DOT com I have problems with templates. I use gcc version 2.8.1. My simple linked list app crash always when I use templetes. I wonder what I doing wrong. Could you tell me how I should to do this. Thanks Jarno Honkanen joh0 AT freenet DOT hut DOT fi /// here is my linked list app /////////////////////////// template class List{ public: List() :root(0), next(0) {} List(T *node) :root(node),next(0) {} ~List(); void add_node(T *node); T* get_node() const { return root; } List* get_next() const { return next; } void set_next(List *list) { next = list; } private: void add_node(List *list); T *root; List *next; }; template List::~List(){ delete root; delete next; } template void List::add_node(List *list){ if (!next) next = list; else next->add_node(list); } template void List::add_node(T *root){ List *list = 0; list = new List(root); add_node(list); } int main() { List *root; int *data; root = new List; // app crash here, why? data = new int; *data = 10; root->add_node(data); delete root; }