Suppose I have a code:
Class A have items which is pushed into a vector...I want to access Class A element from class B through A's vector..
class A
{
friend class B;
vector<A> data; //store info in vector
};
Class B
{
void showDataInClassA();
A a;
}
void B::showDataInClassA()
{
vector<A>::iterator p= a.data.begin();
while(p != a.data.end())
{
//cout<<p->getUserName();
++p;
}
}
However, it doesnt show up. May I get any advice?
Thanks.