πŸ“’ Too many exams? Don’t know which one suits you best? Book Your Free Expert πŸ‘‰ call Now!

  • google app store apple app store
  • βœ–

      Question

      How is data hiding primarily achieved in

      OOP?
      A By making all class members public. Correct Answer Incorrect Answer
      B By using only static methods. Correct Answer Incorrect Answer
      C By declaring member variables as `private` and providing `public` getter/setter methods. Correct Answer Incorrect Answer
      D By avoiding the use of classes altogether. Correct Answer Incorrect Answer
      E By storing data in global variables. Correct Answer Incorrect Answer

      Solution

      By declaring member variables as `private` and providing `public` getter/setter methods.

      Practice Next
      ask-question