我写了一个父类是device
class Device
{
public:
Device();
virtual void paint(QPainter* painter);
}
子类Substation
#include "device.h"
class Substation :
public Device
{
public:
Substation(void);
void paint(QPainter* painter);
}
然后写了一个QHash<QString,Device>
实例化了四个Substation加进去了,之后在调用QHash中的Substation的paint方法时发现调用的是父类Device中的方法,怎样才能让它去调用Substation的paint方法啊??求教!!