LINKED LIST question C++ ...Can we make TWO different node types in one program? -
i have project finish off regarding linked lists. wanted know if possible write in 2 struct nodetype codes create 2 nodes. if how , should place them? code going contain of 1 node type "videos" in list. , node type "customer" details in list.
i plan use functions every other operation enable program do. wanted know code making 2 nodes , how , should specify these nodes when make functions them?(such inserting new video video node , inserting video customer node(showing rented video) etc etc)...
can please explain code's details can understand it?
because instantiation of class template yields new type, can make list node template:
template<class tag> struct listnode { listnode *prev, *next; };
and derive multiple times same template instantiating different tag type:
struct videotag; struct customertag; struct item : listnode<videotag> , listnode<customertag> {};
Comments
Post a Comment