ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Comparing C# and Java
Subject:   access modifiers
Date:   2006-03-31 06:29:19
From:   coco13
please correct me :-) but am i right in thinking that in c# there no way to restrict access to classes in the same namespace?


The protected keyword is really very different in java and c# as in java it allows access to other members of the same package and to subclasses and in c# it only allows access to subclasses. Yeah?


The internal keyword in c# restricts access to the assembly, but this has no bearing on the namespace.


Java really has a fouth access modifier, the 'not-specified' access modifer which resricts access to the package. In many ways I think this is most useful one.


By not allowing us to restrict access to classes in the same namespace/package, doesn't this more or less defeat the point of putting them in different namespaces in the first place?


I feel i must be missing or misunderstanding something...


1 to 1 of 1
  1. access modifiers
    2006-03-31 06:31:53  coco13 [View]

1 to 1 of 1