Method, returning reference to an object
Hello,
I want to call a method and gain reference to proper object. Next I wan't to use this reference to running other methods.
Code:
Kasa [B]myobject;[/B]
Kasa [B]myobject2;[/B]
public void run(){
wybierz();
[B]result[/B].dodaj(this, priorytet); //reference from wybierz();
}
public Kasa wybierz()
{
if(1 == 2){
result = [U]myobject;[/U] //REFERENCE TO OBJECT
}else {
Kasa myobject2;
result = [U]myobject2;[/U]
}
return [B]result;[/B] // myobject or myobject2;
}