हिंदी

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

Advertisements

प्रश्न

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

विकल्प

  • Private

  • Public

  • Protected

  • None 

MCQ
Advertisements

उत्तर

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
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 6: Class as the Basis of all Computation (Objects and Classes) - EXERCISES [पृष्ठ ३८२]

APPEARS IN

अविचल Computer Applications [English] Class 10 ICSE
अध्याय 6 Class as the Basis of all Computation (Objects and Classes)
EXERCISES | Q I. 2. | पृष्ठ ३८२
Advertisements
Share
Notifications



      Forgot password?
Use app×