Computer Science, asked by 278raghav, 2 months ago

Give one example to illustrate a real world class and an object.​

Answers

Answered by seira61
0

Explanation:

Consider an ATM. An ATM is a class. It’s machine which is pretty much useless until you insert your debit card. After you insert your debit card, the machine has information about you and your bank account and the balance in it, so at this point it is an object. You have used a class and created an object, now you can perform operations on it like withdrawal of money or checking you balance or getting statement of your account, these operations will be methods belonging to that class (ATM) but you cannot use them until you create an object out of it.

And when you did perform whatever operation you wanted to perform and clicked exit/cancel and removed your card, you just destroyed the object. Now it is not an object, it has methods and all (the functions an ATM can perform) but you cannot use them until you insert your card again and create an object.

Similar questions