Skip to main content
gamedev.net
🔒 Locked

array and operator []

Started by Silly_con Apr 28, 2004 at 6:00 PM 0 replies 200+ views
Original Post
Silly_con
Silly_con
if you have in a class:
class array{
public:

  int data[100];

  int& operator[](int index)
}

int& array::operator[](int index) { /* bound tests ... */ return data[index]; }
[\Source]

when you call: array v; v[0] = 4;, how you can select using [] operator or accesing directly to the array ?

Topic Locked

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

Sign in to reply to this topic.