Template problem

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
=============================
A.h
=============================

class B;

template <typename T>
class A {
public:
	A() {}
	A(T a){}
	A(const B& b);
};
typedef A<int> iA;

=============================
A.cpp
=============================
#include "A.h"
#include "B.h"

A::A(const B& b)
{
}

=============================
B.h
=============================

class iA; // forward declaration

class B
{
public:
	B() {}
	B(const iA& a);
};

=============================
B.cpp
=============================
#include "B.h"
#include "A.h"

B::B(const iA& a)
{
}


What's wrong with that code?
Last edited on
iA is not visible in B.h and also it is a typedef so do this: iA obj1; where obj1 is of type class A<int>.
iA obj1? Where to put it?
I can't understand :(
Topic archived. No new replies allowed.