Isn't class scope purely for organization?
Posted
by
Di-0xide
on Programmers
See other posts from Programmers
or by Di-0xide
Published on 2012-10-23T07:18:02Z
Indexed on
2012/10/23
11:18 UTC
Read the original article
Hit count: 238
Isn't scope just a way to organize classes, preventing outside code from accessing certain things you don't want accessed?
More specifically, is there any functional gain to having public
, protected
, or private
-scoped methods? Is there any advantage to classifying method/property scope rather than to, say, just public
-ize everything?
My presumption says no simply because, in binary code, there is no sense of scope (other than r/w/e, which isn't really scope at all, but rather global permissions for a block of memory). Is this correct?
What about in languages like Java and C#[.NET]?
© Programmers or respective owner