English

Find the access specifier which prohibits a class member from being used outside a class: - Computer Applications

Advertisements
Advertisements

Question

Find the access specifier which prohibits a class member from being used outside a class: 

Options

  • Private

  • Public

  • Protected

  • None 

MCQ

Solution

Private

Explanation:

When a class member (such as a variable or method) is marked as private, it is inaccessible from outside the class. It can only be accessed within the same class where it was declared. This enables encapsulation by prohibiting direct access to the class's internal details.

shaalaa.com
  Is there an error in this question or solution?
Chapter 6: Class as the Basis of all Computation (Objects and Classes) - EXERCISES [Page 382]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 6 Class as the Basis of all Computation (Objects and Classes)
EXERCISES | Q I. 2. | Page 382
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×