I think you mean JavaScript (JS, based on the ECMA-262 ECMAScript standard) by "Node"?
Files are connected via #include statements. Just imagine thta the file you include is copied right there for now (it does not work like that, but just think it would, because that's how it feels). I will try to put all important things which differ from Java into the following example. Please ask any questions you still have :)
class Foo
{
void bar();
};
use namespace std;
void Foo::bar()
{
int i = 42;
cout << "Hello World! " << i << endl;
}
#include "foo.hpp"
int main()
{
auto ptr_foo = new Foo();
Foo obj_foo();
ptr_foo->bar();
obj_foo.bar();
delete ptr_foo;
return 0;
}