标签:console for nes define ati cto 存在 extend 对象
>class Person {
static sayHello()
{
console.log(‘hello‘) ;
this.sayWorld();
}
static sayWorld()
{
console.log(‘world‘)
}
}
> class Person {
constructor(){
this.constructor.foo() ;
Person.foo();
}
static foo()
{
console.log(‘helloworld‘)
}
}
> class Parent {
static sayHello()
{
console.log(‘parent say hello‘)
}
}
> class Child extends Parent{
static sayHello()
{
console.log(‘child say hello‘);
super.sayHello() ;
}
static sayWorld()
{
console.log(‘child say world‘) ;
}
test()
{
console.log(‘child say test‘) ;
}
}
Parent.sayHello() // parent say hello
Child.sayHello() // child say hello , parent say hello
Child.sayWorld() // child say world
Child.test() // not a function
new Child().sayHello() // not a function
new Child().sayWorld() // not a function
标签:console for nes define ati cto 存在 extend 对象
原文地址:http://www.cnblogs.com/chihaiping/p/6371271.html