Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ please help implementing a few functions in my NodeQueue class! I need help with Default, parameterized, copy constructor, operator=, pop, and serialize. //Node Class

C++

please help implementing a few functions in my NodeQueue class! I need help with Default, parameterized, copy constructor, operator=, pop, and serialize.

//Node Class , we dont need to do anything withb 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:

//DEFAULT: creates a new queue with no elements

NodeQueue();

//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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions

Question

Describe the Indian constitution and political system.

Answered: 1 week ago

Question

Explain in detail the developing and developed economy of India

Answered: 1 week ago

Question

Problem: Evaluate the integral: I = X 52+7 - 1)(x+2) dx

Answered: 1 week ago

Question

What is gravity?

Answered: 1 week ago

Question

What is the Big Bang Theory?

Answered: 1 week ago