So I have a question about using methods.
Alright, let say I want to create a system of atm and bank. I create a class account that has all related attributes such as acc # and balance and blah. Then I create an ATM class that contain methods such as deposit and withdraw. In my main class, I create a customer object that belong to account class, but how do I use the methods from ATM class using the customer object?

Recommended Answers

All 2 Replies

At some stage you will need to tell the ATM which customer/account it is dealing with. You could just add that as a parameter to the deposit & withdraw methods.
OR if one customer is likely to do a load of transactions you could have a logon method in ATM so the customer enters his PIN or whatever, then the ATM knows which customer to use in the following deposit/withdraw etc.

Thank you, this help clear it up. I can see the connection.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.