|
|
Back to UserFriendly Strip Comments Index
|
corwin17's c++ corner: 03/27 operator overloading | by corwin17 | 2014-03-27 10:45:15 |
|
operator overloading | by lenmear | 2014-03-27 11:05:43 |
| I think I understand, but |
by corwin17 |
2014-03-27 11:49:10 |
because the definition of the matrix class includes **p for the actual data, how would that be referenced within the external overloaded function? A, B, & C have all been predefined as 3x3 matrices. I've tried the following,but it don't work (for obvious lack of declarations). [I am worried a bit about scope and memory holes with this method, too.)
matrix& operator+ (const matrix& A, const matrix& B)
{
for(int ii=0 ; ii<A.nrow ; ii++)
{
for(int jj=0 ; jj<A.ncol ; jj++)
p[ii][jj] = A.p[ii][jj] + B.p[ii][jj];
}
}
</code>
[ps - why the heck isn't the /code tag working when I do multiple lines?!] |
|
[ Reply ] |
|
Use the accessors | by lenmear | 2014-03-27 12:00:32 |
|
Danger, Will Robinson! | by lenmear | 2014-03-27 12:27:00 |
|
And people wonder why I refuse to learn OOP. | by firehawk | 2014-03-27 12:38:20 |
|
And why I've refused until thrust upon me! (n/t) | by corwin17 | 2014-03-27 12:42:35 |
|
OOP isn't that bad, it's the unmanaged langauges | by Freakazoid | 2014-03-27 12:47:50 |
|
I use PHP, and I've seen PHP OOP... | by firehawk | 2014-03-27 12:53:53 |
|
<Deleted> | <Deleted> | 2014-03-27 22:45:15 |
|
Whoa! Mods! B-Usted Horizontal Scroll! | by wwill | 2014-03-27 22:25:19 |
|
Thought of that just after submitting, but... | by corwin17 | 2014-03-27 12:40:52 |
|
|
[Todays Cartoon Discussion]
[News Index]
|
|