i need to overload the operator [], any ideas??
What are you having trouble with exactly? Why do you need the subscript operator?
i have an assignment to create the type string as a class and i need to overload the operator [] so that i can use x[i].
The declaration inside your class would look something like:
|
char& operator[] (int pos);
|
Then, you can treat it just like a regular function.
Last edited on
Do you mean?
char& operator[] (int pos);
Andy