You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This statement isn't true. Of course, if you put all 3 classes in the same package it will look like it is, but it's not what the example in the handbook is about - class hierarchies, it's about same-package access.
package org.example;
public class Base {
protected int x = 1;
}
---
package org.example.sub;
import org.example.Base;
public class Derived1 extends Base {
protected int x = 5;
}
---
package org.example;
import org.example.sub.Derived1;
public class Derived2 extends Base {
public void f1(Derived2 other) {
other.x = 10;
}
public void f2(Derived1 other) {
other.x = 10; // Error: 'x' has protected access in 'org.example.sub.Derived1'
}
}
The text was updated successfully, but these errors were encountered:
Hello. I was going through the handbook, and noticed this part about Java:
TypeScript-Website/packages/documentation/copy/en/handbook-v2/Classes.md
Line 691 in c8b2ea8
This statement isn't true. Of course, if you put all 3 classes in the same package it will look like it is, but it's not what the example in the handbook is about - class hierarchies, it's about same-package access.
The text was updated successfully, but these errors were encountered: