Question: In the UnsortedType list class, how can I make the items stored in the list generic (i.e. able to hold both strings and integers? //

In the UnsortedType list class, how can I make the items stored in the list generic (i.e. able to hold both strings and integers?

// IMPLEMENTATION FILE ( itemtype.cpp )

// Implementation depends on the data type of value.

#include itemtype.h

#include

RelationType ComparedTo( ItemType otherItem ) const

{

if ( value < otherItem.value )

return LESS;

else if ( value > otherItem.value )

return GREATER;

else return EQUAL;

}

void Print( ) const

{

using namespace std;

cout << value << endl;

}

void Initialize( int number )

{

value = number;

}

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!