implementing nested linked list in c++ -


is kind of implementation of nested linked list valid in c++? if yes,then how declare head nested linked lists? syntax accessing data in lists inside? here part of general code. i'm trying perform library management system in c++.

     struct course      {           string course_name;             struct course_books               {                  struct wait_list                   {                    long stu_num;                    //date inserted                    wait_list * next_wait_stu;                   };                  struct voters_list                   {                    long stu_num;                    int vote;                    voters_list * next_voter;                    };                   struct deposit_list                    {                   long stu_num;                     //date given                     //bring date                   deposit_list * next_depositor;                    };             };          course * next_course;            };                struct demand               {                  int isbn;                  string book_name,                            course,                            author,                           edition;                  int demands_num;                 struct demanding_students                   {                   string demander_name;                   int demander_stu_number;                    //demand date                   demanding_students * next_demanding_stu;                       };               demand * next_demand;                  };        struct student_info        {            struct all_deposited_books               {                 int isbn;                 //date given                 //bring date                 all_deposited_books * next_dep_book;                   };              struct today_deposited                {                 int isbn;                  today_deposited * next_today_dep_book;                 };              }; 

you want use classes instead. like:

    class student_info{         protected:           struct all_deposited_books           {             int isbn;             //date given             //bring date            };           struct today_deposited           {             int isbn;            };         public:           all_deposited_books * next_dep_book;           today_deposited * next_today_dep_book;     }; 

then create class instance like: student_info thebeststudentinfo; , if want accses struct variable inside call: thebeststudentinfo.all_deposited_books[0].isbn = 5; or that. aswell dont think can create struct instance inside struct itself, like:

struct all_deposited_books    {             int isbn;             //date given             //bring date             all_deposited_books * next_dep_book; //<- gonna cause problems    }; 

first create struct , how going like, , can start creating how many instances of want :)


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -