Application Programming Interface

The application programming interface (API) constitutes the methods and attributes that a class makes visible to the rest of the program. The code for a class is encapsulated behind the API.

So in this example of a superclass and two subclasses the only way that the balance can be changed is through the deposit and withdrawal methods. This ensures that deposits and withdrawals are handled correctly by the software. As written there is no method for changing the the owner of an account so the program will not be able to edit the owner String and give the account to another person.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License