Forums Register Login

Why a regular class cannot be protected.

+Pie Number of slices to send: Send
Hi, Why a regular class cannot be protected.
+Pie Number of slices to send: Send
 

Harikrishna Gorrepati wrote:Hi, Why a regular class cannot be protected.


You can use the same modifiers for inner classes that you use for other members of the outer class. For example, you can use the access specifiers — private, public, and protected — to restrict access to inner classes, just as you do to other class members.
+Pie Number of slices to send: Send
Hi Abimaran, I am not clear. I am referring basic helloworld class which cannot have protected access specifier. what is the reason.
+Pie Number of slices to send: Send
 

Harikrishna Gorrepati wrote:Hi Abimaran, I am not clear. I am referring basic helloworld class which cannot have protected access specifier. what is the reason.


Please => TellTheDetails <=.
+Pie Number of slices to send: Send
What is the use of assigning protected access to a top level class?? What purpose would it serve??
+Pie Number of slices to send: Send
So that super(Parent) class can be accessed in different packages



+Pie Number of slices to send: Send
Oh My Bad, I confused with the regular and the regular inner class. Sorry Harikrishna Gorrepati, I confused you.
+Pie Number of slices to send: Send
For this purpose, you can use/make the Parent class' Constructor as protected!
When people don’t understand what you are doing they call you crazy. But this tiny ad just doesn't care:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1334 times.
Similar Threads
protected class
Why a basic regular class cannot be private and protected
protected class ???
Question on protected access modifier
protected class?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 17:06:21.