Здравствуйте, KALAKOM, Вы писали:
KAL>Как предопределить тип NM::A::Str в 2.h?
Можно где-то так, но это не досконально тоже самое.
//type_forward.h
template<class T> class type_forward;
//StrForward.h
#include <type_forward.h>
namespace NM
{
class A;
}
template<>
class type_forward<NM::A>
{
public:
typedef struct tagStr{int a;} Str;
};
//1.h
#include "StrForward.h"
namespace NM
{
class A : public type_forward<NM::A>
{
public:
typedef type_forward<NM::A> Str;
};
}
//2.h
#include "StrForward.h"
namespace NM
{
class B
{
public:
foo(type_forward<A>::Str* pStr);
};
}
[In theory there is no difference between theory and practice. In
practice there is.]
[Даю очевидные ответы на риторические вопросы]