Question: I have to write a singly and doubly linked list program and I need help writing the doubly linked list source file (dnode.cpp) Here is

I have to write a singly and doubly linked list program and I need help writing the doubly linked list source file (dnode.cpp)

Here is the doubly linked list header file:

#pragma once #include "node1.h"

#ifndef MAIN_SAVITCH_DNODE_H #define MAIN_SAVITCH_DNODE_H #include // Provides size_t and NULL #include // Provides assert

namespace main_savitch_5 { class dnode { public: // TYPEDEF typedef double value_type;

// CONSTRUCTOR dnode( const value_type& init_data = value_type(), dnode* init_fore = NULL, dnode* init_back = NULL ) { data_field = init_data; link_fore = init_fore; link_back = init_back; }

// Member functions to set the data and link fields: void set_data(const value_type& new_data) { data_field = new_data; } void set_fore(dnode* new_fore) { link_fore = new_fore; } void set_back(dnode* new_back) { link_back = new_back; }

// Const member function to retrieve the current data: value_type data() const { return data_field; }

// Two slightly different member functions to retrieve each current link: const dnode* fore() const { return link_fore; } dnode* fore() { return link_fore; } const dnode* back() const { return link_back; } dnode* back() { return link_back; } private: value_type data_field; dnode *link_fore; dnode *link_back; };

}

#endif

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!