Hi, i have problem with code in my Master's degree work.
I have class A and class B. In class C i defined A as private member and class B in database (private class which is using map from std). Now i need access from class A to class B. I did it like this:
//core class creating database
template <class Obj>
class database
{
private:
typedef std::map<int, Obj> map;
map z;
public:
Obj ret(int ID)
{
map::const_iterator i = z.find(ID);
return i->second;
}
};
class A
{
private:
int ii;
public:
void SomeFunc(){
// <main class>::<database of B>.<return one class B>.<return data from B>
ii=C::_b.ret(1).reti();
}
};
class B
{
private:
int i;
public:
int reti(){return i;}
};
//main class
class C
{ //give class A access to private data
friend class A;
private:
static database<B> _b;
};
now this give me link error "error LNK2001: unresolved external symbol "private: static class ......."
can be this error from accessing uninitialized static data? if not, what's wrong?
i have another problem.
data in B::i is changing by itself. at init i set it on 32, but at second call there is number 53664.
how can private member do that?