T
Telos
Ok, having trouble figuring out why this doesn't compile:
class A
{
public:
A( int x ) : _x( x ){};
private:
int _x;
A();
};
class B : public A
{
public:
B( A *anA ) : _a( anA ) {};
private:
A *_a;
};
It says that B does not have access to A's default constructor, but
this shouldn't be an issue because B shouldn't be constructing an A
anyway. It should only be taking a pointer to a pre-existing A.
I've tried it with two different compilers... so I guess this is
proper behavior, but I would like to understand why.
class A
{
public:
A( int x ) : _x( x ){};
private:
int _x;
A();
};
class B : public A
{
public:
B( A *anA ) : _a( anA ) {};
private:
A *_a;
};
It says that B does not have access to A's default constructor, but
this shouldn't be an issue because B shouldn't be constructing an A
anyway. It should only be taking a pointer to a pre-existing A.
I've tried it with two different compilers... so I guess this is
proper behavior, but I would like to understand why.