请看下面的评论:
class MyClassA {
constructor(optionalParam?: any) {
}
initialize(optionalParam?: any) {
}
}
class MyClassB extends MyClassA {
constructor(requiredParam: any) {
super(requiredParam);
// OK.
}
// I want to override this method and make the param required
// I can add the private modifier but I want it to
// be public and hide the method with optionalParam
initialize(requiredParam: any) {
// compiler error!
}
}
我怎样才能做到这一点?
谢谢!