Question: 5. The node class is defined as follows: 1. template 2. class node { 3. public: 4. 5. 6. 7. 8. 9. 10. init_link;

5. The node class is defined as follows: 1. template 2. class node { 3. public: 4. 5. 6. 7. 8. 9. 10. init_link; 11. 12. 13. 14. 15. 16. 17. // TYPEDEF typedef Item value_type; // CONSTRUCTOR node(const Item& init_data = Item(), node* init_link = NULL) { } data field link_field init_data; // MODIFICATION MEMBER FUNCTIONS Item& data() { return data_field; } node* link() { return link_field; } void set_data(const Item& new_data) { data_field = new_data; } void set_link(node* new_link) { link_field = new_link; } 18. 19. // CONST MEMBER FUNCTIONS const Item& data () const { return data_field%; } return link_field; } 20. 21. const node* link() const { 22. 23. private: 24. Item data field; 25. node* link_field; 26. }; Write the implementation of a const forward iterator for this class. Use inline functions in your implementation. The iterator is a template class.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
