Abstraction

Solution

Abstraction is separating what something does from how it does it. The interface is the what: the operations you can use. The implementation is the how: the details underneath, hidden from you. The interface is a promise, and the implementation is free to change as long as it keeps that promise.

Solution

It hides the memory addressing. Underneath, the machine takes the array’s starting address and adds to compute the element’s address, then reads from that address. You write numbers[2] and never think about addresses or bytes.

Solution

It hides the fixed-size backing array: its capacity, how full it is, and the resizing. Without it, the client would have to commit to a capacity up front, track how many slots are in use, and, when the array fills up, allocate a larger array, copy every element across, and reassign the variable. The dynamic array does all of that on its own.

Solution

The interface says add appends a value; it says nothing about cost. Inside, most adds are a single write, but when the backing array is full, add allocates a larger array and copies every element. If you only know the interface, you cannot see that variation and cannot explain why a program that adds millions of elements spends time copying. If you know the internals, you can predict that behavior instead of being surprised by it.