我的好像要不要都没错的..你看看呢
#include<iostream>
using namespace std;
class a
{
public:
class iterator
{
public:
int i;
int j;
iterator(int i1=0,int j1=0):i(i1),j(j1)
{
}
void demo()
{
cout<<i<<" "<<j<<endl;
}
};
int i;
int j;
a(int i1=1,int j1=1):i(i1),j(j1)
{
}
void demo()
{
cout<<i<<" "<<j<<endl;
}
};
template <typename C>
class b
{
public:
void f(const C& container, C::iterator iter)
{
cout<<container.i<<endl;
cout<<iter.i<<endl;
};
};
int main()
{
a a1;
a::iterator iter;
b<a> b1;
b1.f(a1,iter);
return 0;
}
[[it] 本帖最后由 sunkaidong 于 2008-4-30 14:24 编辑 [/it]]