Computer Science Canada Accesing a variable from different class |
Author: | Chinmay [ Thu Jan 03, 2008 2:01 am ] | ||||
Post subject: | Accesing a variable from different class | ||||
Ok so i have two classes in two different files and by the way I am a newbie wannabie programmer. I want to acces and print the variable from the first class, how would i do it?
class 2
Why wouldnt this work? |
Author: | HeavenAgain [ Thu Jan 03, 2008 2:12 am ] | ||||
Post subject: | RE:Accesing a variable from different class | ||||
uh whats the package all about? and you have 2 main class, which does not work like that.... and your hey object of the class1 is null i believe, and to make it actually point to class1 you have to do something called "instantiate", by adding assigning new class1(); to it, which then calls to the constructor and make it not null try something like this....
|