title: Virtual protected function error
body: <p>I have Packet class contains virtual method and I have LogInRequest class which extends the packet class </p>
  
  <p>Packet.h file</p>
  
  <pre><code>class Packet {
  
  public:
      Packet();
      virtual ~Packet();
  
  protected:
      virtual char* toByte() = 0;
      virtual void fromByte(char *d) = 0;
      virtual Packet* handle() = 0;
  
      short m_bodySize;
      int64_t m_deviceId;
  };
  
  
  /*
   * LogInRequestPacket
   */
  class LogInRequestPacket: public Packet{
  
  public:
  
      LogInRequestPacket();
      virtual ~LogInRequestPacket();
  
      virtual char* toByte();
      virtual void fromByte(char *d);
      virtual Packet* handle();
  };
  </code></pre>
  
  <p>Packet.cpp file</p>
  
  <pre><code>#include "Packet.h"
  
  Packet::Packet() {
      // TODO Auto-generated constructor stub
  
  }
  
  Packet::~Packet() {
      // TODO Auto-generated destructor stub
  }
  
  /*
   * LogInRequestPacket
   */
  LogInRequestPacket::LogInRequestPacket(){
      printf("LogInRequestPacket is being created... \n");
  }
  
  LogInRequestPacket::~LogInRequestPacket(){
  
  }
  
  char* LogInRequestPacket::toByte(){
  
  }
  
  void LogInRequestPacket::fromByte(char *d){
  
  }
  
  Packet* LogInRequestPacket::handle(){
  
  }
  </code></pre>
  
  <p>I am trying to create this LogInRequestPacket from factory like this</p>
  
  <pre><code>Packet *packet = m_packetFactory-&gt;createInstance(static_cast&lt;PACKET_TYPES&gt;(type));
  packet-&gt;fromByte(pdata);
  </code></pre>
  
  <p>And it seems like trying to call the protected virtual fromByte function instead of the child class's fromByte function.</p>
  
  <p>I am getting a red line at the line declaring "virtual void fromByte(char *d) = 0" in Packet class scope in Packet.h file and it complains "... is protected"</p>
  
  <p>Also, it complains too with x within context</p>
  
  <pre><code>packet-&gt;fromByte(pdata);
  </code></pre>
  
  <p>How do I fix this problem. Thanks in advance...</p>