Question 187Asked in DSSSB TGT Computer Science, 25 Jun 2023, Shift 2 (12:30 PM)

Which access modifier can be used to access members in deriving class?

  1. AVoid
  2. BProtected
  3. CPrivate
  4. DPublic
Show answerHide answer

Correct answer: (B) Protected

Explanation

Protected members are accessible inside the class and in classes derived from it, but not to unrelated outside code. Private members are not accessible in derived classes.

From DSSSB TGT Computer Science PYQ, 25 Jun 2023, Shift 2 (12:30 PM)

This is question 187 of DSSSB TGT Computer Science PYQ, 25 Jun 2023, Shift 2 (12:30 PM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.