Original Post
Hi!
I have a litle problem here. I have a base class a Serializable interface and a class derived from the base class, like this:
class Serializable
{
public:
virtual void Serialize( std::ostream& out) const = 0;
virtual void DeSerialize( std::istream& in) = 0;
};
class Base : public Serializable
{
public:
Base();
~Base();
void Serialize (std::ostream& out) const;
void DeSerialize (std::istream& in);
protected:
float _member1, _member2;
};
class Derived : public Base
{
public:
Derived();
~Derived();
protected:
float _member3;
}
Ok so far so good. Here comes the problem: i want to be able to serialize _member3 in Derived class. Probably by overloading the Serialize / DeSerialize functions. But then i must also serialize _member1 and _member2 like in the base class or call the serialize functions from the base class before i store _member3. Is there a nicer way of doing this ?
< There is no stupid questions, only stupid answers! >