In the array implementation of a stack, why should items and top be specified as private?

What will be an ideal response?

You ensure that client code cannot violate the ADT’s walls. Otherwise the client could access entries in the array directly instead of using the ADT stack operations.

Computer Science & Information Technology

You might also like to view...

Every new cell/smartphone has to include a GPS chip

Indicate whether the statement is true or false

Computer Science & Information Technology

Which of the following would not likely be a stakeholder in a civil lawsuit against a major automobile manufacturer?

a. Government regulatory agencies b. The United Autoworkers Union c. The judge assigned to the case d. Owners of that company's products e. All of these would be interested parties.

Computer Science & Information Technology