我想将字符数组转换为具有相同布局的虚拟类,除了虚拟方法。我怎样才能做到这一点?
class RecordStruct
{
private:
virtual MStream& write2stream(MStream& os) const = 0;
public:
friend MStream& operator<<(MStream& os, const RecordStruct& stru)
{
return stru.write2stream( os );
};
};
class VIRT_struct : public RecordStruct
{
char A[7]; char B[8];
virtual MStream& write2stream(MStream& os) const;
};
const RecordStruct* = some_cast<const RecordStruct*>( pdata );