class Parent {
public let a = 123;
let b = 456;
}
class Child extends Parent {
public let b = 789;
}
let parent = Parent();
print parent.a; // out: 123
print parent.b // out: VisibilityError: field "b" on class "Parent" has a visibility of "private"
let child = Child();
print child.a; // out: 123
print child.b; // out: 789
parent.b = 1000; // out: VisibilityError: field "b" on class "Parent" has a visibility of "private"
child.c = 2000; // out: VisibilityError: field "c" on class "Child" has a visibility of "private"
Questions
Include protected or just merge with private? Not at this time
Default visibility? public
Can this be a compile time error? It needs to be to correctly/easily allow the class's method access it's own private fields/methods
private
,public
,protected
Example
Questions
protected
or just merge with private? Not at this time