Implementation of Data Hiding Whats is Data Hiding? Within the DeclareTwoEmployees class, you must use the public
Question:
Implementation of Data Hiding
Whats is Data Hiding?
Within the DeclareTwoEmployees class, you must use the public methods setEmpNum() and getEmpNum()to be able to set and retrieve the value of the empNum field for each Employee because you cannot access the private empNum field directly. For example, the following statement would not be allowed:
clerk.empNum = 789;
This statement generates the error message "empNum has private access in Employee", meaning you cannot access empNum from the DeclareTwoEmployees class. If you made empNum public instead of private, a direct assignment statement would work, but you would violate an important principle of object-oriented programming—that of data hiding using encapsulation. Data fields should usually be private, and a client application should be able to access them only through the public interfaces—that is, through the class's public methods.
To do:
A. Make a class consisting of data fields. Include a method that displays the values in addition to instance methods that set the values of the data fields.
B. Make at least three objects should be instantiated by the Main Class.
PS: You are free to be as creative as you like as long as you adhere to the rules.
Database Systems Design Implementation and Management
ISBN: 978-1337627900
13th edition
Authors: Carlos Coronel, Steven Morris