Java 方法().方法().方法();这该怎么做?
Java method().method().method(); How to do this?
例如,我该怎么做?
getServer().getManager().registerNewUser(arguments);
和
getServer().getStats().user(arguments);
类似的东西,我试过在网上搜索但找不到任何教程,所以我在这里问。
在 OOP 中,一般来说,这个概念称为 class 组合 更多关于这个你可以在这里找到它 https://en.wikipedia.org/wiki/Object_composition
还有java以及组合和继承的区别https://www.baeldung.com/java-inheritance-composition
例如,我该怎么做?
getServer().getManager().registerNewUser(arguments);
和
getServer().getStats().user(arguments);
类似的东西,我试过在网上搜索但找不到任何教程,所以我在这里问。
在 OOP 中,一般来说,这个概念称为 class 组合 更多关于这个你可以在这里找到它 https://en.wikipedia.org/wiki/Object_composition
还有java以及组合和继承的区别https://www.baeldung.com/java-inheritance-composition