【发布时间】:2015-04-06 14:10:57
【问题描述】:
我确实尝试了以下方法:
class Child {
public func() {
alert("hello");
}
constructor() {
Parent.apply(this, arguments);
}
}
Child["prototype"] = Object.create(Parent.prototype)
Child["prototype"].constructor = Child;
但是 Child 类的实例没有 func() 方法。
js类如何继承?
【问题讨论】:
标签: javascript oop inheritance typescript