हिंदी

How Are Private Members of a Class Different from Public Members ? - Computer Applications

Advertisements
Advertisements

प्रश्न

How are private members of a class different from public members?

एक पंक्ति में उत्तर
लघु उत्तरीय

उत्तर १

The scope of the private members is within the class whereas the scope of the public members is global.

shaalaa.com

उत्तर २

  1. Private:
    1. A private access specifier restricts access to a variable or method within a class.
    2. Private elements are not shared with other classes during inheritance.
  2. Public:
    1. A public specifier indicates that a variable or method is directly accessible from all classes.
    2. During inheritance, one class shares public elements with another. 
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 IV. 6. | पृष्ठ ३८४
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×