This is issue is at the very heart of OOP. You must understand scope properly in order to use it properly. I'd suggest you get a book on that, or google it :
...