Can C++ define arguments | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can C++ define arguments

basically what I'm asking is if you can define what you want an argument to be. for example say I want to create a game and for the monster I want the 1st argument to define the monster by melee(m), ranged(r), spellcasting(s). 2nd argument to be respawn time. 3rd to be exp ect..

30th Nov 2017, 2:24 AM
Robert Cowart
Robert Cowart - avatar
1 Answer
+ 1
Yes, you define the arguments when you program the constructor for the monster class. monster(char type, int respawnTime, ...) { this.setType(type); this.setTime(respawnTime); ... }
30th Nov 2017, 3:05 AM
Adam Schmitt
Adam Schmitt - avatar