0

I am trying to take my array of classes and add the values from one part of it together.

I have everything ready but being able to add the parts of the array into a variable which I can use.

Right now, I am using this to try and add up the totals

order1 = carArray[0].getordervalue;
order2 = carArray[1].getordervalue;
order3 = carArray[2].getordervalue;

I am getting an error like this one

'error C2440: '=' : cannot convert from 'int (__thiscall Car::*)(void)' to 'int'
Conversion is a valid standard conversion, which can be performed implicitly or by use of static_cast, C-style cast or function-style cast'

when I try to compile. It is not letting me pt what is stored in that part of the array, into another variable [which I will then use to find the total]

Does any have any suggestions or tips on how to fix this?

I am still working on it, so if I fix it before someone replies, I will edit this and show how I did fix it.

Thank you.

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by Jaycii
0

From the hint of the name I think getordervalue is a class method, so you need to call it like this: order1 = carArray[0].getordervalue(); And make sure the capitalization is correct too.

0

I can't believe I missed that. I feel really dumb now.

Thank you so much, the error is gone now. It always seems to be the simple things that I miss.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.