Hello.
If I have the following classes:
class B {};
typedef B tB;
if A is:
class A
{
void f(B* pB) {}
};
in the header where A is defined, I can write
class B;
to avoid including the header file declaring B.
But what for typedef:
if A is:
class A
{
void f(tB* pB) {}
};
if I write
class tB;
in A.h, I have the follwing compiler error:
error C2371: 'tB' : redefinition; different basic types, because a
typedef is not a class.
I tried several syntax, but finally, is it possible to declare a
typedef like we do for a class?
Thanks for help.
If I have the following classes:
class B {};
typedef B tB;
if A is:
class A
{
void f(B* pB) {}
};
in the header where A is defined, I can write
class B;
to avoid including the header file declaring B.
But what for typedef:
if A is:
class A
{
void f(tB* pB) {}
};
if I write
class tB;
in A.h, I have the follwing compiler error:
error C2371: 'tB' : redefinition; different basic types, because a
typedef is not a class.
I tried several syntax, but finally, is it possible to declare a
typedef like we do for a class?
Thanks for help.
Comment