hi all,
I am new to c++ and i would like to know what does the underscores followed by the vaiables name in a constructor of the class, i have a small piece of code like this
server::server(ba::io_service& io_service, int thnum, int port)
: io_service_(io_service),
acceptor_(io_service_, ba::ip::tcp::endpoint(ba::ip::tcp::v4(), port)),
new_connection_(connection::create(io_service_)),
thp(thnum) {
acceptor_.async_accept(new_connection_->socket(),
boost::bind(&server::handle_accept, this,
ba::placeholders::error));
}
here i have io_service_ after the contructor arguments followed by the ':'
i dont understand any of this why there is a symbol ':' after the arguments and what are those following that symbol ':' actually means .I dont know how to mention them too. pls help me with your simple word to make me undestand.
the entire class which contains the above code is as follows.
class server : private boost::noncopyable {
public:
server(ba::io_service& io_service, int thnum, int port=10001);
private:
void handle_accept(const boost::system::error_code& e);
ba::io_service& io_service_;
ba::ip::tcp::acceptor acceptor_;
connection::pointer new_connection_;
tp::pool thp;
};