views:

31

answers:

0

Hi,every one, I have a question about how protocol buffer interact with existed protocol mechanism,Say code below:

class PacketBase
{
public:
   PacketBase();
private:
   int msgType;
   int msgLen;
private:
   MessageBuilder* m_pMsgBuilder;   /// do Write and Read From msg stream

};

class LoginRequest : public PacketBase
{
 /// here we can use proto replace the msg field defined here
 /// invoke write or read method in packetbase to serialze or de-serialize
};

Can protocol buffer do the job while maintain the class hierarchy unchanged?