|
-
June 9th, 2011, 10:03 PM
#1
Operator [] Overloading
Hello codeguru members,
I'm implementing an class to manipulate mathematical matrices and I want it to have an interface as close as mathematical notation as possible.
So here it is my question:
can I overload some kind of operator[][] ?
I would like to access elements like this:
matrix A(3,3);
cout << A[0][1];
Is this possible?
An solution could be an friend operator[] function that retuns another class, like the matrix_line, and then overloading [] again, this time returning the element, right? But i find this solution deselegant and unclear. Any ideas?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|