Having trouble writing a custom Map class

[No longer needed]
Last edited on
cout << mArray.display; display is a function. You need to add parenthesis. It also wants a key and a value as its 2x parameters. But what do you actually want display to do? I imagine that a display function would only take in the key, and then give the value. It's kinda defeats the purpose for the map to need both the key and value. Your remove function doesn't have any code, so I'm not sure what you want it to do, but I would say the same thing there, it's redundant to require both the key and value for displaying or removal.

your insert function always inserts the data into aData[0]. Is that intentional? Sounds like you might want another variable to keep track of where you are in your internal array.

What do you actually want to happen in remove? Should the size variable be decremented? Should the array itself be re-allocated but without copying over the the given element?

1. I want the Display to show all the elements of the array both key and value

2. Remove I'm working on, so no code there yet, need display to work first, but that's something I may need to come back for in future

3. It should be able to insert it anywhere in the array, a mistake on my part

4. I want the element in the array to be deleted from the array, it doesnt need to decrement, but that's an option to explore
Please DON'T delete your posts after getting an answer. It makes this thread useless as a learning resource for others.
Registered users can post here. Sign in or register to post.