the x within the main function can't be "seen" by the doSomething function unless it explicitly passed to it. That's generally a good thing. Though it is because of how you've scoped things there

hehe sorry just had to poke.

I think changing how you pass things might change it a little bit, but it's more about scope than anything really.
I think encapsulation is good because I think it enhances changeability. If data is tightly encapsulated, you should be able to remove the implementation (leaving the interface) and create a new implementation without issues like having to deal with a ton of now undefined variables. You'd only need to worry about a few function calls, to keep everything in the rest of the program working smoothly.
Also, being the security nerd i am (security is like one of my fun side computer hobbies haha) I say that it helps from that standpoint as well because if you have say a buffer overflow issue, encapsulating your data should minimize the area that an exploit could effect. I don't know for sure on that one, but it sure makes good sense. If I'm wrong please correct me though.