Advertisements
Advertisements
प्रश्न
Differentiate between private and protected visibility modifiers.
फरक स्पष्ट करा
Advertisements
उत्तर
| S. No. | Private | Protected |
| 1. | Private members are only visible within the class where they were defined. | Protected members are visible to classes within the same package and to subclasses (including those from other packages). |
| 2. | Private elements are not shared with other classes during inheritance. | Protected elements can be applied to derived classes during inheritance. |
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
