You are designing a class with several private instance vari

You are designing a class with several private instance variables, can these variables be accessed by methods outside of the class definition? If you try to read the value of a private instance variable outside of the class, what kind of method you should use? ANS (1): circle YEs or No ANS(2): You are designing a class with several private instance variables, to allow the class user to update the variable values, what kind of method they should use? ANS: You are designing a class with several private instance variables to comply with the encapsulation OOP principle, to allow other class to access these variables, You would design special methods for read operations, what kind of methods are these? ANS (1). What should be the prefix for the method name? You would design special methods for read operations, what kind of methods are these? ANS (3). What should be the prefix for the method name?

Solution

1) (1) No

(2) get methods.

2) You should use a set method to give access to change private variables.

3) (1) get methods

(2) public

(3) set methods

(4) public

 You are designing a class with several private instance variables, can these variables be accessed by methods outside of the class definition? If you try to re

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site