Code: Select all
struct santasbag
{
int toy1;
float toy2;
char toy3;
int reindeer1;
float sleigh;
bool claus;
int....
...and so on...
}
Now say i have a function that will use one or two items from that struct (eg toy1 and sleigh). I could do it two ways:
Code: Select all
void Xmas::SendPresent(int var1, float var2)
{
x = var1;
y += var1 + var2;
}
santabag gimmeprezzies;
sendpresent (gimmeprezzies.toy1,gimmeprezzies.sleigh)
Code: Select all
void Xmas::SendPresent(santabag my_bag)
{
x = my_bag.toy1;
y += my_bag.toy1 + sleigh;
}
santabag gimmeprezzies;
sendpresent (gimmeprezzies)
Also, in case it IS slower, would it be too bad if santasbag only had say, 6-8 items?