I have 2 classes, one is specialized. In the specialized class Class_second I would like to use private field server from Class_second. The constructor Class_first creates server connection and I would like to use this in another specialized classes.
class Class_first {
friend class Class_second<Message>;
Class_first() : server(create_conn(ip, port){
}
...
private:
unique_ptr<Server> server;
};
This is one of few specialized classes.
template<>
class Class_second<T> {
public:
void foo(T) {
Class_second.server.get(); //this is wrong, how to correct it
...
}
};
How I can obtain access to the server field of Class_first object. What is the best way to use it?
Possibly how I can return the reference to the server and use it in Class_second?
Aucun commentaire:
Enregistrer un commentaire