The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

corwin17's c++ corner: 03/27 operator overloading by corwin172014-03-27 10:45:15
  operator overloading by lenmear2014-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 lenmear2014-03-27 12:00:32
        Danger, Will Robinson! by lenmear2014-03-27 12:27:00
          And people wonder why I refuse to learn OOP. by firehawk2014-03-27 12:38:20
            And why I've refused until thrust upon me! (n/t) by corwin172014-03-27 12:42:35
            OOP isn't that bad, it's the unmanaged langauges by Freakazoid2014-03-27 12:47:50
              I use PHP, and I've seen PHP OOP... by firehawk2014-03-27 12:53:53
          <Deleted><Deleted>2014-03-27 22:45:15
            Whoa! Mods! B-Usted Horizontal Scroll! by wwill2014-03-27 22:25:19
        Thought of that just after submitting, but... by corwin172014-03-27 12:40:52

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)