constructor in this programyou would have needed an additional call to deposit(to put the opening balance in the account public and private notice the keywords public and private in the bankaccount class these keywords are access modifiers and determine what methods can access method or field the balance field is preceded by private field or method that is private can only be accessed by methods that are part of the same class thusbalance cannot be accessed by statements in main()because main(is not method in bankaccount howeverall the methods in bankaccount have the access modifier publicso they can be accessed by methods in other classes that' why statements in main(can call deposit()withdrawal()and display(data fields in class are typically made private and methods are made public this protects the datait can' be accidentally modified by methods of other classes any outside entity that needs to access data in class must do so using method of the same class data is like queen beekept hidden in the middle of the hivefed and cared for by worker-bee methods inheritance and polymorphism we'll briefly mention two other key features of object-oriented programminginheritance and polymorphism inheritance is the creation of one classcalled the extended or derived classfrom another class called the base class the extended class has all the features of the base classplus some additional features for examplea secretary class might be derived from more general employee classand include field called typingspeed that the employee class lacked in javainheritance is also called subclassing the base class may be called the superclassand the extended class may be called the subclass inheritance makes it easy to add features to an existing class and is an important aid in the design of programs with many related classes inheritance thus makes it easy to reuse classes for slightly different purposea key benefit of oop polymorphism involves treating objects of different classes in the same way for polymorphism to workthese different classes must be derived from the same base class in practicepolymorphism usually involves method call that actually executes different methods for objects of different classes for examplea call to display(for secretary object would invoke display method in the secretary classwhile the exact same call for manager object would invoke different display method in the manager class polymorphism simplifies and clarifies program design and coding for those not familiar with theminheritance and polymorphism involve significant additional complexity to keep the focus on data structures and algorithmswe have avoided these features in our example programs inheritance and polymorphism are important and powerful aspects of oop but are not necessary for the explanation of data structures and algorithms software engineering