Attention: Answers.ros.org is deprecated as of August the 11th, 2023. Please visit robotics.stackexchange.com to ask a new question. This site will remain online in read-only mode during the transition and into the foreseeable future. Selected questions and answers have been migrated, and redirects have been put in place to direct users to the corresponding questions on Robotics Stack Exchange. Additional details are available here.
A nodehandle is a RAII (resource acquisition is initialization) type according to source: ros.org. RAII is a C++ term meaning that resources are cleanup up afterwards when the object goes out of scope. In rospy the nodehandle-like class is the rospy module itself. Both solutions seems more idiomatic to their languages, but that is a guess on my part.
Private node handles are a way to access names private to the ROS node, which would create ambiguous names in some situations otherwise. They are a nodehandle to a different namespace. AccessingPrivateNamesWithNodeHandle. I have not used them myself.
underscores at the end of a member variable are a C++ convention. As with all C++ things, this is not universal and will differ in different organisations.
A nodehandle is a RAII (resource acquisition is initialization) type according to source: ros.orgros.org - NodeHandles. RAII is a C++ term meaning that resources are cleanup up afterwards when the object goes out of scope. In rospy the nodehandle-like class is the rospy module itself. Both solutions seems more idiomatic to their languages, but that is a guess on my part.
Private node handles are a way to access names private to the ROS node, which would create ambiguous names in some situations otherwise. They are a nodehandle to a different namespace. ros.org - AccessingPrivateNamesWithNodeHandle. I have not used them myself.
underscores at the end of a member variable are a C++ convention. As with all C++ things, this is not universal and will differ in different organisations. organisations.