pass value from one class to another class


#1

I have two class…class A and class B……i have one variable in class A……i want to use that variable in Class B…….so i dont know how can i do that……help me


#2

try sending it via post


#3

You could use a singleton class (exists for the whole application) and set/get from that.

When you say class, are you talking about scenes (I.e. set a value in scene 1 and use that value in scene 2 after replaceScene(scene2))?


#4

@Adam Reed….yes u right……i want to use that on 2nd scene……and yaa i will try it via singleton class…


#5

Singleton class is good idea though you can read/modify the variable by making it static also.