c++

abc
Last edited on
You have a couple of options.

1) You could derive separate BalanceInquiry classes. One for checking, one for savings. Probably overkill if the logic is the same for both.

2) As your professor suggested, you could add a bool argument to BalanceInquiry's constructor to indicate if the inquiry is for savings or checking.

BTW, you have a memory leak in your program. Your ATM is eventually going to run out of memory and crash.

Line 130: You create a BalanceInquiry object assigned to tempPtr.
Line 136,141,146 You create new objects assigned to tempPtr without deleting the old object.
Topic archived. No new replies allowed.