Question: #ifndef NODES_H #define NODES_H #include #include using namespace std; // Abstract class. Base class for StringNode, IntegerNode, and FloatNode // // Do NOT change this

 #ifndef NODES_H #define NODES_H #include #include using namespace std; // Abstract

#ifndef NODES_H #define NODES_H

#include #include

using namespace std;

// Abstract class. Base class for StringNode, IntegerNode, and FloatNode // // Do NOT change this class class DataNode { public: virtual void printTo(ostream &os) = 0; // pure virtual method, makes the class Abstract virtual ~DataNode(); // labeling the destructor as virtual allows // the subclass destructors to be called };

// Uses double dispatch to call the overloaded method printTo in the // DataNodes: StringNode, IntegerNode, and FloatNode // // Do NOT change this method ostream& operator

// Do NOT change this method DataNode::~DataNode() {}

class StringNode : public DataNode { public: string* mystring = nullptr;

// Add constructor, destructor, and printTo methods };

class IntegerNode : public DataNode { public: int myinteger = 0;

// Add constructor, destructor, and printTo methods };

class FloatNode : public DataNode { public: float myfloat = 0.0;

// Add constructor, destructor, and printTo methods };

#endif /* NODES_H */

Complete the StringNode, IntegerNode, and FloatNode classes. Each class requires constructor, destructor, and printTo methods. Each constructor should accept an argument and save that value within the node. The printTo method is an example of "double dispatch. https://en.wikipedia.org/wiki/Double_dispatch Once the data node classes are complete, use the comments within driver.cpp as instructions on what functionality should be added to the main method. Complete the StringNode, IntegerNode, and FloatNode classes. Each class requires constructor, destructor, and printTo methods. Each constructor should accept an argument and save that value within the node. The printTo method is an example of "double dispatch. https://en.wikipedia.org/wiki/Double_dispatch Once the data node classes are complete, use the comments within driver.cpp as instructions on what functionality should be added to the main method

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!