|
-
February 6th, 2010, 10:39 PM
#7
Re: operator overloading
I made an app once that required some math structures like vectors and matrices. I overloaded the operators on the classes i created in order to get the same behavior in the app as in math:
Ex:
[1,2,3] + [1,2,3] = [2,4,6]
where [1,2,3] is a 3d vector with the values x=1, y=2, and z=3. This made the code much easier to understand and the vectors behaved just as they would in math.
(i hope i did the math right, its been a long time)
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
|