Hi,
I want to pass an object to another function (of another class) to assign new value to it: code below
Code:
public class MyClass
{
InfoSupplier infosupplier;
public void myFunc(){
Info infocarrier = new Info();
this.infosupplier.supply(infocarrier); //infosupplier has already been declared and allocated elsewhere
//the problem is after this line, infocarrier still doesn't have the new values (members)
//which means the assignment inside the function supply() is NOT effective
}
}
public class InfoSupplier
{
Info info;
public void supply (Info ic)
{
ic = this.info ;//this.info has been declared and allocated, assigned value elsewhere
}
}
What is wrong with the assignment? Given everything in Java is pointer
Thanks.