Ask Question
19 July, 04:52

Consider a class called Rocket that has a private instance variable called Engine. You are writing a "getter" for the Engine. Using the guiding principles of data encapsulation, under what circumstances is it allowed to return a reference to the existing Engine?

+4
Answers (1)
  1. 19 July, 06:08
    0
    when user wants duplicate copy of the object

    Explanation:

    Encapsulation are one of the key foundations of object-oriented programming (OOP). It involves the bundling of data or information with the methods and various techniques which operate on that data.

    It can be used in hiding the true values or state of a structured data object that is in a class, preventing unauthorized parties' direct access to them.

    The circumstances that can be allowed in returning a reference to the existing Engine is when user wants duplicate copy of the object.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Consider a class called Rocket that has a private instance variable called Engine. You are writing a "getter" for the Engine. Using the ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers