CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11

Threaded View

  1. #1
    Join Date
    Oct 2004
    Ho Chi Minh, Vietnam

    Assign new value to an object in a function

    I want to pass an object to another function (of another class) to assign new value to it: code below
    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
    Last edited by choconlangthang; August 8th, 2010 at 04:08 AM. Reason: missing the question :)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

By using this site, you agree to the Privacy Policy