How Are Private Members of a Class Different from Public Members ?
Advertisements
प्रश्न
How are private members of a class different from public members?
एक पंक्ति में उत्तर
लघु उत्तरीय
Advertisements
उत्तर १
The scope of the private members is within the class whereas the scope of the public members is global.
shaalaa.com
उत्तर २
- Private:
- A private access specifier restricts access to a variable or method within a class.
- Private elements are not shared with other classes during inheritance.
- Public:
- A public specifier indicates that a variable or method is directly accessible from all classes.
- During inheritance, one class shares public elements with another.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
