There are two classes named classA and classB. Both classes are in the same package. Can a private member of classA can be accessed by an object of classB?

By ayush goel in 22 Sep 2023 | 11:30 am
ayush goel

ayush goel

Student
Posts: 346
Member since: 21 Sep 2023

There are two classes named classA and classB. Both classes are in the same package. Can a private member of classA can be accessed by an object of classB?

22 Sep 2023 | 11:30 am
0 Likes
divas goyal

divas goyal

Student
Posts: 453
Member since: 22 Sep 2023

   - No, a private member of `classA` cannot be accessed directly by an object of `classB`. Private members are accessible only within the same class.


23 Sep 2023 | 04:25 pm
0 Likes

Report

Please describe about the report short and clearly.