The compiler doesn't know where to look for total, so it looks for local variables and then global variables. If you want to access the static member, you have to qualify it with the class it's declared in:
item::total += a.itemprice;
Alternatively you can use the object to get to it as well:
a.total += a.itemprice;
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401