OK, I\'ll just post the complete program even though it has extraneous stuff and the code in question is the dead code…
#include
#include
Some thoughts about why you have to specify std::ifstream
in constructor's initializer .
I think typedef
is the culprit - ifstream
is defined as typedef basic_ifstream
). If you change your constructor to
explicit InFStream(
char const* filename,
ios_base::openmode mode = ios_base::in | ios_base::out
):
basic_ifstream>( filename, mode ){}
you also don't have to specify std::basic_ifstream
. I cannot find details about why typedef
works this way, but the problem is reproducible. For instance,
namespace test1
{
class A {
public :
static const int cn = 1;
virtual ~A();
A(int t): x(t){};
int x;
};
class B:public A
{
public:
B(int t) : A(t){};
};
typedef B XX;
};
class C:public test1::XX
{
int aaa;
public:
explicit C(int x) :XX(x) // error
explicit C(int x) :test1::XX(x) // ok
explicit C(int x) :B(x) // also ok
{
aaa = A::cn;
};
};