Skip to main content
gamedev.net
🔒 Locked

re: making an array class

Started by GameDev135 Aug 1, 2002 at 2:03 PM 4 replies 250+ views
Original Post
GameDev135
GameDev135
I am trying to make a resizable array class. The basics of it are working, however, I would like to incorporate it so that the brakets can be used. For example, I want to be able to do this. ARRAY x(10); //makes the array size 10 x[0] = 3; // etc.... I know that somehow I have to overload the operators, but how can I do this. FYI, the array is being stored as a pointer in the class, just I want to be able to use the class without even thinking about pointers specifically. Feel free to email me at NYYanks432@hotmail.com if you have any questions
Feel free to email me at NYYanks432@hotmail.com if you have any questions
Sneftel
Sneftel
Do a websearch for operator overloading. It''s very simple.
WayfarerX
WayfarerX
Why not just use std:vector? Does all this for you...
"There is no reason good should not triumph at least as often as evil. The triumph of anything is a matter of organization. If there are such things as angels, I hope that they're organized along the lines of the mafia." -Kurt Vonnegut
GameDev135
GameDev135
Cool. The operator class works.

What is the reason that I would want to make a const method though?
Feel free to email me at NYYanks432@hotmail.com if you have any questions

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.