What was the reason for using parameters in constructors?

fassihi

14-10-2007 06:22:56

I was wondering about the reasoning behind using parameters to set up an object and passing a string to the constructor? What are the advantages?

I am having a hard time finding the appropriate parameters to set up the objects, using strongly typed constructors and intellisense with compile time error indication was easier for me I guess.

betajaen

14-10-2007 11:51:28

Take Actor for example, it has ~25 "params". If wrote NxOgre without a params system it would have over 25 arguments in the constructor.

So the parameters allow you to pick and choose what you want, and in any order.

There are two ways to use params. The string based "mass: 10", or the class based "ActorParams ap;ap.mMass = 10;". String based is more readable but slower, and the class based; reusable and faster.

Visit this link and scroll down a little. If your unsure what "param" it is. The list of params for a string are in the xxxParams constructor comment, which can be formatted via doxygen.