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
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
