TypeScript/tests/baselines/reference/classConstructorParametersAccessibility.errors.txt
2016-02-26 14:02:26 -08:00

35 lines
1.2 KiB
Plaintext

tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility.ts(12,4): error TS2341: Property 'p' is private and only accessible within class 'C2'.
tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility.ts(19,4): error TS2445: Property 'p' is protected and only accessible within class 'C3' and its subclasses.
==== tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility.ts (2 errors) ====
class C1 {
constructor(public x: number) { }
}
var c1: C1;
c1.x // OK
class C2 {
constructor(private p: number) { }
}
var c2: C2;
c2.p // private, error
~
!!! error TS2341: Property 'p' is private and only accessible within class 'C2'.
class C3 {
constructor(protected p: number) { }
}
var c3: C3;
c3.p // protected, error
~
!!! error TS2445: Property 'p' is protected and only accessible within class 'C3' and its subclasses.
class Derived extends C3 {
constructor(p: number) {
super(p);
this.p; // OK
}
}