LiveWire Network Peer Answers Peer Support Teen Forums Tech Forums College Forums 696 users online 224767 members 665 active today Advertise Here Sign In
TeenCollegeTechPhotos | Quizzes | LiveSecret | Memberlist | Dictionary | News | FAQ
Member Spotlight
MoonLoveBaby
Movies: Moulin Rouge The Producers The DaVinci...
Mood: Euphoric
You have 1 new message.
Emergency Help
Until you sign up you can't do much. Yes, it's free.

Sign Up Now
Membername:
Password:
Already have an account?
Invite Friends
Active Members
Groups
Contests
Moderators
4 online / 26 MPM
Fresh Topics
  LiveWire / Technical Forums / Programming & Application Development / Adding Reply

Quoting Post
Archived Topic: It will not be bumped to the top of the forum.
Topic Access Levels -- protected... !protected enough
Membername   Not a member? Sign Up Free (takes 20 seconds)
Password   Forgotten your password?
Post

Font:   Size:   Color:

FAQ Keyword Search:
Post Options
Favorites Manager
Notify me of new replies to this topic by email
Notify me of new replies to this topic by private message
Original Post
Whuppee Posted at 10:36 pm on May 28, 2006
This is specifically in regard to Java.  Of course, access levels are present in many languages... but possibly with different uses.  I believe C# may suffer from the same issue I feel that Java is, but I'm not yet familar enough with it to say.

As stated in the title / description.. this isn't so much a question, as an opinion I'd like feedback on.  If anything, I'd love to hear other opinions on this topic.


I'm going to temporarily assume I'm safe in skipping over public and private, believing them to be rather self-explanatory--do let me know if I'm wrong.  I'll be happy to talk about them as well, at request.

Anyway:

I always used protected to mean, "Only this class and/or subclasses of it will have access."

Given the practices I follow, that it worked in the bounds I expected it to, and that I was never informed otherwise.... well, it worked as expected.

At least, until I read that protected also meant, "Anything in the same package."


So, if I don't want something to be public...

But I want subclasses to be able to use it: protected.

Except that I ONLY want subclasses to be able to use it.

I dislike being "forced" to package things in regard to this, rather than in regard to their function.

I would personally love to see two versions of protected.  One that excludes all but subclasses... another that operates as the current one does.


Thoughts?

Replies
Whuppee Posted at 5:42 pm on May 29, 2006
Ah, thanks for the response.

It's too bad they removed support for that feature... I, at least, would have considered it to have value.

I've come up with a few ways that still somewhat enforce this functionality, but I'm not wild about them.


Also, I've no idea what specific comments were made against myself / my subject matter... and it's entirely possible that those that made them won't even check this thread again, but I'd like to respond to both of them as well as anyone else who might happen to read this:


I love programming.  I love talking about and teaching programming related things.

I partially alluded to this (or meant my statement to, anyway) in my original post when I said that if anyone wasn't clear on what I was going on about that I'd be happy to explain.

Seriously.  Anyone wants me to explain intro programming material, classes, "best practices", encapsulating construction, design patterns, analysis mechanisms, inheritance / abstractions, etc... I'd be quite happy to.

One note, though =P ... I'm not wild about having 500 pages of code mailed to me, asking why it doesn't work.

In any case, if anyone doesn't understand what I'm talking about... or would like me to explain something else... I'll at least attempt to.

I feel I have a lot of valuable things to share, but I have far more still to learn myself.  On some topics, I'm certain this process could be easily reversed... and I would like to see that.

I'd love to be part of turning this community into one where we're all participating in learning and teaching each other.

telomere13 Posted at 10:55 am on May 29, 2006
Actually, there used to be a "private protected" keyword in Java which worked the same way as the C++ "protected" keyword (accessible to inheritors, but not others in a package), but it hasn't existed for quite some time now, presumeably because people didn't find it useful enough.

And for all the people telling the original poster not to post here because it has "crossed the line" and "no one will understand what the hell [he's] talking about," please leave.  Just because you happen to not know something doesn't mean that other people your age aren't allowed to know it, too.

Jay JWLH Posted at 10:45 pm on May 28, 2006
Post from this position was omitted due to content violations
sas quatch69 Posted at 10:40 pm on May 28, 2006
Post from this position was omitted due to content violations
All 4 previous replies displayed.