+ 3
Is there a faster way to assign the variables in a class constructor?
I'm trying to assign a metric ton of values passed to a class constructor to variables declared in the class. Is there a faster way to do this? class Example { int a,b,c,d,etc; example(int inA, int inB, int inC, int inD, int inEtc) { a=inA; b=inB; c=inC; d=inD; etc=inEtc; } /* Any optimizations/shortcuts are welcome, even in the parameter declaration! */
4 Answers
+ 1
Ina Well, they're all necessary and individual so sadly I can't. Thanks for the help though.
+ 1
Of course you can! thats why you use modern IDE! such as eclipse they have constructor generator! :D