Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Programming Talk / C++ / C# - access function

Author
Message
How is it going
18
Years of Service
User Offline
Joined: 18th Sep 2007
Location: California
Posted: 16th Oct 2009 04:50
hello, been a long time since i've posted
I'm currently working on a game engine with SDL and am trying to figure an access function.

ex:
person RANDOMGUY( 1, "GUY", 0, 0 ); // index, name, x, y
person GENERIC( 0, "GENERIC", 0, 0 );

GENERIC.access( RANDOMGUY ); // access function that sets generic values to that of the other member

//==============================================================
//access function
void person::access( person a ) {
name = a.name;
...
etc...
}

ok that works and is fine but I want it so I can pass an int value

GENERIC.access( 1 ); // like that

thank you very much for your help
How is it going
18
Years of Service
User Offline
Joined: 18th Sep 2007
Location: California
Posted: 18th Oct 2009 08:07
anyone?
Jeff032
18
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 18th Oct 2009 17:57
So you want to copy the values from one person to another person, by specifying the id of the person to copy from?

If so, I believe your person class would need to have a static array of persons.

Whenever a person is created you place it in the array using its id as the index, and whenever a person is deleted you remove it from the array.

Then when you call access, you can use the array to get the person to copy.

How is it going
18
Years of Service
User Offline
Joined: 18th Sep 2007
Location: California
Posted: 18th Oct 2009 21:15
correct...
how would I create an array of people...? what type, rather?
How is it going
18
Years of Service
User Offline
Joined: 18th Sep 2007
Location: California
Posted: 20th Oct 2009 06:56
sry, not quite sure what u mean...
can you explain more?

Login to post a reply

Server time is: 2026-06-10 09:31:50
Your offset time is: 2026-06-10 09:31:50