I have the following C++ class:
class Eamorr {
public:
redispp::Connection conn;
Eamorr(string& home, string& uuid)
{
//redispp::Connection conn("127.0.0.1", "6379", "password", false); //this works, but is out of scope in put()...
conn=new redispp::Connection("127.0.0.1", "6379", "password", false); //this doesn't work ;(
}
put(){
conn.set("hello", "world");
}
...
}
As you can see, I want conn
to be initialised in the constructor and available in the put()
method.
How can I do this?
Many thanks in advance,