class Widget{ .. } // Widget Class
class Interface { // pure virtual functions .. } // Interface class (Abstract Class)
class WidgetType1 : public Widget, public Interface { ... } // Type 1 Widget (ComboBox) inherits widget and Interface
class WidgetType2 : public Widget, public Interface { ... } // Type 2 Widget (LineEdit) inherits widget and Interface
Widget* widget = getWidget(...);
Interface* interface = dynamic_cast<Interface*> (widget); // Convert Widget to Interface
我应该做什么访问 Widget 对象上的接口方法(基本上是 WidgetType 1/2)
我无法键入 Widget 指针引用的 WidgetType1 的转换对象