Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Basic Privacy Question

 
golfinguy4
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Say I have a class foo. In the class, there is a method whatever which takes an argument of type foo. Would the method be able to access the private members of the argument?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Guy,

Welcome to JavaRanch!

First, a bit of business: you may not have read our naming policy on the way in. It requires that you use a real (sounding) first and last name for your display name.
You can change your display name here. Thanks.

Now, the answer to your question: yes. Protection is on the class level. Objects of the same class can't protect themselves from each other.
[ November 18, 2004: Message edited by: Ernest Friedman-Hill ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic