Thanks for the reply.In the Debug menu, there is Step Backward, or Alt [.
It's the same idea for a struct. The struct definition is the template for how a struct instance is laid out in memory.
That's the wrong way to think about things. Instead of thinking about the files where the functions are defined, the member functions of a struct are internal to the class. Whether the function definitions appear in the header file or in another .cpp file is really irrelevant.
The header file isn't the class blueprint -- the class definition, class InvItem, in this case -- is the blueprint, or template.
It's different because this struct doesn't have any member functions. It's also different in that the three data members are public.
In C++, the only difference between a struct and a class is that members of a struct are public, by default. That's the only difference. A struct can have member functions, just like a class.
I don't see Alt[ in debug menu. I see F11 step in, F10 step over and shift-F11 step out.
Yes, I think toward the last part, I realize the .h file is not the blue print, only the invItem is the Class, that is the blue print to create item1, item2 and item3.
I did not realize struct is a blueprint also. So the difference is struct are all PUBLIC . Class is more complicate with private and public. I have not learn struct can have member function yet.
In struct st, you access the member by st.cost, I have not seen in the invItem item1 that I can access item1.cost like in struct. Is this because double cost is PRIVATE. that if I declare double cost in PUBLIC, I can access from program using item1.cost = 6.95? If that is true, this clears up more question for me.
Thanks for explaining this.