Hello all! I am using MFC with C++ trying to simply add one array to another with the code: totalBalance[count] = totalBalance[count] + payment[count]; but I'm getting the error:
Have no idea why it wont work. Any input would be great. Thanks!
Error 1 error C2676: binary '+' : 'System::Double ^' does not define this operator or a conversion to a type acceptable to the predefined operator c:\scalderon\mfc windows\ch01\checkingaccount\checkingaccount\Form1.h 309
After Looking at it some more, It looks like I cant perform any type of simple arithmetic on a System::Double^, So I guess the real question would be: is there a way to get around that or to convert them to a regular double and then perform the operation and the convert back??
Are you sure that's MFC and not C++/CLI? :)
Well it's written in C++, I'm not sure why my class is called MFC programming. We use Windows Form Application in C++ but not all the same rules for C++ apply. Normally I can do the arithmetic without problem but I cant and I dont have a clue why.
Originally Posted by BMJ
Because it's C++/CLI. You can't just mix managed and unmanaged types. You're getting burned here.
And finally, please, it's not written in C++. It's written in C++/CLI. Make a distinction. If your teacher is dumb enough to call it MFC, then slap him/her. It's C++/CLI and not ISO C++.
Ok, well, I just use the information given. Any suggestions then?
Nope. Sorry. I don't deal with C++/CLI, so I don't know it.
Perhaps someone else might, though.
I don't mess with C++/CLI aka ECMA 372 either, but this is where I started looking: C++/CLI - Wikipedia, the free encyclopedia. Near the top of the article, there is a topic about the distinction between .Net handles, and C++ pointers. Even later in the article, there is a topic about handles to objects that are passed by reference. The convention has something to do with which portions of the code are subject to automatic garbage collection (remember that stuff from Java, right?) and which portions are not.
The language specifications are at the bottom of the article. I am confident that the standards discuss the procedure for "de-referencing" the handles, in order to perform operations on the values to which they refer.
New Ink -- Henry