+ 2
=>> What is abstract data type(ADT) in any object oriented programming language?
I know that ADT only mentions what operations are to be performed but not how these operations will be implemented. But I can not imagine it. It will be useful if you explain me using an example. Note: I am not talking about abstract classes in java.
1 ответ
+ 4
Take a real life example. A motor spins. How it does it isn't important. The fact you can use it's spinning to pump water, cut grass, or lift objects is what is important.
An ADT provides a service that can be used for many different things just like that motor. An iterator over a collection is a good example. It doesn't care about the data in the collection. All it cares about is providing the next element, when asked.