1.

Which among the following can restrict class members to get inherited?(a) Private(b) Protected(c) Public(d) All threeThe question was posed to me in an internship interview.My doubt stems from Access Specifiers in division Access Specifiers of Object Oriented Programming

Answer»

The correct option is (a) Private

To explain I would say: Private members of a CLASS can’t be inherited. These members can only be ACCESSIBLE from members of its own class only. It is USED to SECURE the data.



Discussion

No Comment Found

Related InterviewSolutions