嗨,我在 OOP 方面不是很好,对不起,如果有人问过同样的问题。现在我在从另一个对象访问一个对象的属性时遇到问题,其中两个对象都属于一个对象
public abstract class GameClient (){
protected ClientRegistry registry;
..
}
public class MarketClient extends GameClient {
public Auctioneer auctioneer = null;
public Specialist specialist;
...
((GenericDoubleAuctioneer) auctioneer).setRegistry((MarketRegistry) registry);
specialist = registry.addSpecialist(clientId);
}
public class Specialist extends AccountHolder() {
public Specialist(final String id) {
this(id, null);
...
}
public interface Auctioneer extends QuoteProvider (){
public MarketRegistry getRegistry();
public List configuration
... }
public class DailyAssessmentReport(){
protected void calculateProfits() {
final Specialist specialists[] = GameController.getInstance().getRegistry().getSpecialists();
//later, I'll get the ID of each specialist from specialists[];
...
...
public Map< specialistID, List, Score> Result;
//this Map contains specialistID , auctioneer.configuration, score
}
我想做的是制作一个包含(specialistID、auctioneer.configuration、profit)的MAP。我的问题是如何访问/ Auctioneer.configuration
从DailyAssessmentReport
类中获取价值?
我真的很感谢你的回答