TypeScript 1.3
受保护的
class Thing {
protected doSomething() { /* ... */ }
}
class MyThing extends Thing {
public myMethod() {
// OK,可以在子类里访问受保护的成员
this.doSomething();
}
}
var t = new MyThing();
t.doSomething(); // Error,不能在类外部访问受保护成员元组类型
// Declare a tuple type
var x: [string, number];
// 初始化
x = ['hello', 10]; // OK
// 错误的初始化
x = [10, 'hello']; // ErrorLast updated