cross pointing between two classes

Hi guys.

Is there a way to do the following:


1
2
3
4
5
6
7
class b{
     a * as;
}

class a{
     vector<b*> bs;
}


If not, and I have this:

1
2
3
4
5
6
class b{
}

class a{
     vector<a*> as;
}


how can I tell which a is pointing at a certain b?

Thanks
You can do the first one, if you declare class a
1
2
3
4
5
6
7
8
9
class a;

class b{
     a * as;
}

class a{
     vector<b*> bs;
}
thank.

I think I my meaning wasn't clear.

The segment of code I put up-there was meant to be placed in the header file as I want the reference to stay. The code I have placed is supposed to be in two different files.

I think I am clear now.

Anyhow, I have created a map:
map<b*, a*>
and I think it should work. Any ideas how to test this?

Thanks
Topic archived. No new replies allowed.