Question: C++ Need help with a few NodeQueue class functions! I need help with parameterized, copy constructor, front, back, operator=, pop, and serialize. //Node Class ,

C++

Need help with a few NodeQueue class functions! I need help with parameterized, copy constructor, front, back, operator=, pop, and serialize.

//Node Class , we dont need to do anything with this class

class Node{

friend class NodeQueue; //allows direct accessing of link and data from class NodeList

public:

Node() : m_next(NULL){}

Node(const DataType& data, Node* next = NULL) : m_next( next ), m_data(data){}

Node(const Node& other) : m_next( other.m_next ), m_data( other.m_data ){}

DataType& GetData(){

return m_data;}

const DataType& GetData() const{

return m_data;}

private:

Node* m_next;

DataType m_data;

};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//NodeQueue class, I need help implementing these functions

class NodeQueue: public DataType{

friend std::ostream& operator<<(std::ostream& os,

const NodeQueue& nodeQueue);

public:

//PARAMETERIZED: creates a new object that holds a count number of elements initialized to the value, value

NodeQueue(size_t size, const DataType& value);

//COPY: creates a new object based on the data of ano;ther queue thats getting copied

NodeQueue(const NodeQueue& other);

//OPERATOR=: assigns a new value to the calling object which is copy of the rhs object. //returns a reference to the calling object

NodeQueue& operator= (const NodeQueue& rhs);

//POP: removes from the front of th;e queue //check to seee if the queue is empty beforehand

void pop();

//SERIALIZE{ outputs to the os the content of the queue object

void serialize(std::ostream& os);

private:

Node *m_front;//points to front element

Node *m_back;//points to back element

int m_size;//Contains the amount of elements in the queue

};

#endif

I tried to provid enough information to help out with this portion of the project. If you need extra information, here is a link to my DataType header and source files and NodeQueue Header and Source Files. https://docs.google.com/document/d/1yEm6WUzjmmE1VmCv3nLqzHhIc7x3340JRKZyTS9Om24/edit?usp=sharing

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!