我想像这样在抽象类中重载抽象方法:
abstract class Animal {
public abstract communicate(sentence: string): void;
public abstract communicate(notes: string[]): void;
}
class Human extends Animal {
public communicate(sentence: string): void {
// Do stuff
}
}
class Bird extends Animal {
public communicate(notes: string[]): void {
// Do stuff
}
}
Run Code Online (Sandbox Code Playgroud)
但是,Typescript 给出了一个错误,指出我错误地扩展了基类 (Animal)
有什么我做错了吗?就像期望根据 OOP 无论如何都能工作的东西?或者它是 Typescript 不支持的东西?
注意:与本例不同,参数的类型可以是完全不同的类型。
更新:此问题中描述的问题不再相关,因为导致此问题的限制已解除。如果您遇到类似的问题,请随意创建一个新问题,但据我所知,我遇到的问题是由已解除的限制引起的。
在 Google Cloud Shell 中,我尝试通过代理连接字符串与我在 Compose 上运行的 RethinkDB 进行连接,以在部署之前测试我的应用程序,但似乎端口(或其他什么?)已被阻止。我尝试按照撰写支持工程师的建议告诉网络,但他对 GCS 也没有太多经验。
所以我试过这个:
telnet <url-of-rethinkdb> 15407
Run Code Online (Sandbox Code Playgroud)
但是它说明了以下内容:
Trying <ip-of-rethinkdb>...
telnet: Unable to connect to remote host: Connection timed out
Run Code Online (Sandbox Code Playgroud)
所以我的问题是,假设是防火墙导致了这种情况,我可以在哪里更新 Google Cloud Shell 的防火墙规则?(如果可能的话)
此外,如果他们可能是发生这种情况的不同原因,欢迎提出建议。
firewall compose-db rethinkdb google-cloud-platform google-cloud-shell