r/programminghelp • u/pikipupiba • Apr 04 '19
Help passing new values to objects.
I want to be able to change the parameters of some objects that represent different animations at will. My current method accomplishes what I want but involves comparing strings, which I imagine is really slow. Is there a way to accomplish this same thing without needing to compare strings or better yet, just set the first value in the struct to the actual variable I would like to change?
Step 1: Set up struct to pass animation variables to object.
Step 2: Put together array of new values and send to object.
Step 3: Update object values based on array of new values. An empty string signifies the end of the new value list.
3
Upvotes
1
u/TreeBaron Apr 04 '19
Not sure of the context here but...
When you make a new class you can then treat the class as a variable. So tell the function you are passing it in a new variable of you object type and then pass it in.
//A class can even hold itself as variables
Class Dog
{
}
int AgeOfDog(Dog max)
{
}