class MemoryStream { virtual void Serialize(void* ioData, uint32_t inByteCount) = 0; virtual bool IsInput() const = 0; }; class InputMemoryStream: public MemoryStream { ... // 중간 생략 virtual void Serialize(void* ioData, uint32_t inByteCount) { Read(ioData, inByteCount); } virtual bool IsInput() const { return true; } }; class OutputMemoryStream: public MemoryStream { ...// 중간 생략 virtual void Serialize(void* ioData, uint32_t inByteCount) { Write(ioData, inByteCount); } virtual bool IsInput() const { return false; } }