Advanced Function Question

I'm just wondering. Is there a way to have a function take user defined variables for certain arguments. I have a function in a class in a namespace. It's a tool for rpgs.

Here's the prototype

int OgreRanSwordStrikesBtl(int OgreSwordStrikesID, int DamageAmount, int EnemyHealth, string EnemyName);

now the first argument has to stay the same. That determines whether the attack generates for a light attack, or a critical attack.

The last three deal with the users input.

Say in their program they don't want their damage amount variable to be DamageAmount, or their EnemyHealth variable to be called EnemyHealth, or the string containing their enemy's name to be EnemyName...

is there a way around this, or no?
Last edited on
A way around what? The parameter names are completely irrelevant, in fact, they don't need names at all.
can you explain that a little. I thought in order to use a function you had to have the variables that are in the arguements in your own source code....

so if a programmer used my function they could pass their variable..

AngryMansHp into the 3rd arguement?

not sure what you meant by parameter names are irrelevant. I could have done this?

int OgreRanSwordStrikesBtl(int OgreSwordStrikesID, int , int , string );

? if so, I didn't know that, lol.

so basically naming certain variables within my library is only to my own benefit of keeping track of things?
so basically naming certain variables within my library is only to my own benefit of keeping track of things?


You got it =]

It is also for clarity, programmers will be able to see your variable names so don't name them flyingdonkeymonkeyjuice if it's a string that tells you what the company's name is.
unless of course your in the flying donkey monkey juice selling business, hahaha.
Topic archived. No new replies allowed.