T
tarmat
Hi guys,
I have a base class, something like this:
class Base
{
private:
int m_Identifier;
protected:
Base(int id):m_Identifier(id){}
public:
virtual ~Base(){}
};
All the other objects in my project are derived from this class. I'm
trying to create stream constructors for them. Such as
class Derived : public Base
{
public:
Derived(std::ifstream& in);
}
The first variable of the stream is the identifying number, but I
don't know how to write the ctor of Derived to accomodate this. I want
to be able to do the equivalent of the following (which is obviously
not legal)
Derived:erived(std::ifstream& in):Base(in >>)
{}
How do I get around this problem *without* changing the Base class?
thanks for any help
I have a base class, something like this:
class Base
{
private:
int m_Identifier;
protected:
Base(int id):m_Identifier(id){}
public:
virtual ~Base(){}
};
All the other objects in my project are derived from this class. I'm
trying to create stream constructors for them. Such as
class Derived : public Base
{
public:
Derived(std::ifstream& in);
}
The first variable of the stream is the identifying number, but I
don't know how to write the ctor of Derived to accomodate this. I want
to be able to do the equivalent of the following (which is obviously
not legal)
Derived:erived(std::ifstream& in):Base(in >>)
{}
How do I get around this problem *without* changing the Base class?
thanks for any help