yungman
- 5,741
- 294
I just finish my notes on stepping through the program and to show description, cost and units have different addresses for the 3 overload constructors. I attached the page of my notes. This is getting more complicated, I really have to stop, going through it to see how constructors are in action.
Seems like Constructor is NOT being run right at the beginning of the program like Distructor that run right before the end of the program whether it's called in main() or not. Constructor has to be called in the main() before it's executed. Like in the program that doesn't go to the first Constructor#1 until the line invItem item1, invItem item2 for Constructor#2 and invItem item3 for Constructor#3.
Seems like Constructor is NOT being run right at the beginning of the program like Distructor that run right before the end of the program whether it's called in main() or not. Constructor has to be called in the main() before it's executed. Like in the program that doesn't go to the first Constructor#1 until the line invItem item1, invItem item2 for Constructor#2 and invItem item3 for Constructor#3.