copy of object?

This is a discussion on copy of object? within the C++ Programming forums, part of the General Programming Boards category; if i pass my object > Code: Search Area mapnode[dwnMax][acrMax] as a parameter of a function call as below > ...

  1. #1
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,403

    copy of object?

    if i pass my object >
    Code:
    Search Area mapnode[dwnMax][acrMax]
    as a parameter of a function call as below >


    Code:
     SetFscore(mapnode);

    Code:
    void SetFscore(SearchArea mapnode[dwnMax][acrMax])
    {
               //do stuff
    }
    is it automatically passed by reference? or am i creating a copy of the whole array of objects during the scope of the function? i see that the object in the calling function is changed after the call which is what i want so i assume some kind of pointer or reference is implied automatically
    i do not want to be adding masses of objects on the stack
    Last edited by rogster001; 09-29-2009 at 04:24 AM.

  2. #2
    Registered User jdragyn's Avatar
    Join Date
    Sep 2009
    Posts
    92
    You are passing what amounts to a pointer to a SearchArea array. You are not copying the entire array.

  3. #3
    Dae
    Dae is offline
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Your multidimensional array doesn't match, eh? First it's the max acr/max dwn, then it's the max dwn/max acr. They are probably the same number, but I was bored and thought I'd point it out.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  4. #4
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,403
    haha, i will edit that, just sloppy typing the example in, i had cleared it some lines to post....i am past letting those sort of bugs into my code now......i think...!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Texture Management in OpenGL
    By Brafil in forum Game Programming
    Replies: 13
    Last Post: 07-16-2009, 04:32 PM
  2. Telling a shared_ptr not to delete object?
    By TriKri in forum C++ Programming
    Replies: 5
    Last Post: 08-16-2008, 04:26 AM
  3. Object destroy itself?
    By cminusminus in forum C++ Programming
    Replies: 28
    Last Post: 03-27-2008, 01:08 AM
  4. Question on l-values.
    By Hulag in forum C++ Programming
    Replies: 6
    Last Post: 10-13-2005, 04:33 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21