Anyway, from the point of view, "protected" totally fails to help
control dependencies. Sure, in another unit I might not be able to
write:
Test().protectedMethod();
But I can trivially just write:
1 2 3 4 5 6 7
|
class MyTest() extends Test() {
shared void callProtectedMethod() {
protectedMethod();
}
}
MyTest().protectedMethod(); |
Thereby _completely_ subverting the supposed control that "protected" provides.
Basically "protected" is useless because it doesn't prevent another
"unit" from depending upon the protected declaration, and any client
can always work around it.
Partager