请教一个OOD的问题

different types of Alexa devices are given, each one has to display/output the status of its battery charging status to the user. 请问假如在面试中遇到这样的题目,该怎么回答最好

你先说下你是怎么approach的吧

我觉得可以有个interface device,里面有个显示电量的抽象方法,然后所有类型的Device继承这个Interface,具体的Device的具体的显示电量的方式将Override这个Interface里面的抽象方法。 目前就想到这么多了

目前题目信息太少,唯一看到的就是 different types of Alexa devices
你用interface是可以的,但是估计面试官应该要follow up提更多需求