2
Answers

Sharing Objects Among Methods

bcgreen

bcgreen

20y
1.5k
1
OK, here's the deal. I've declared a class, and want to reference it in another class...so, I use the statement: class myclass = new class(); OK, so far so good...I can use the fields and methods of the class through this instantiated object just fine but only in the method it's delcared in. If I try to reference "myclass" in another method, it basically doesn't exist. So stupid question: how do I create an object that can be "seen" by all methods in a class? Thanks much! Bryan
Answers (2)