Which of the following statements describe encapsulation in object-oriented programming?

All QuestionsCategory: Cpp LanguageWhich of the following statements describe encapsulation in object-oriented programming?
Anonymous asked 3 years ago

Options:

  1. Data and the code that acts on that data are treated as separate entities
  2. Making a variable private restricts access to it
  3. Methods can be set up to limit the ways in which data may be modified
  4. Data can be accessed through exposed methods only
  5. Encapsulation protects data in the object’s variables from unauthorized access
  6. Encapsulation encourages tight coupling

1 Answers
Anonymous answered 3 years ago

The correct answers are:

  1. Making a variable private restricts access to it
  2. Methods can be set up to limit the ways in which data may be modified
  3. Data can be accessed through exposed methods only
  4. Encapsulation protects data in the object’s variables from unauthorized access