Inso Reiges wrote:
Quote:
On Jun 6, 9:04 pm, Erik Wikström <Erik-wikst...@telia.comwrote:
Quote:
>On 2007-06-06 15:48, Inso Reiges wrote:
>>
Quote:
>>Hi,
>>I`m new to C++ and OOP in general and i come from long-time C mindset.
>>So i have some style questions.
>>I have a class that needs to be initialized by over nine parameters.
>>So i decided to put this mess into some kind of an object (here by
>>object i don`t mean a class instance) and pass it to constructor. In C
>>such thing would usually be done by filling out a struct. Should i use
>>an object (class instance) in C++ or is it ok to use structs?
>Since the difference between a struct and a class is minimal in C++ it
>does nor really matter, you can easily make them both behave the same
>way. But since it's a matter of style take a look at the following and
>tell me why a struct/class would be better than passing them all normally:
>>
<snip>
>
Thanks for the answer.
The reason i want to use some kind of a construct to hold init params
of the object is because i want the client to have access to this
params, i.e. a get method.
Thinking of it now, i think the real question i need answered is,
which is the most client-oriented way to hold these init variables.
>
My little bit of knowledge gleaned over the past few days would say an
initializer list would help you. It sets defaults, but can be overridden
when calling your class. Just my 2 cents.
--
[there are no x's in my email]
I have the right to remain silent
(and should probably use it as much as possible)
Anything I type can and will be used against me
in a court of idiocy
I have the right to be wrong
(and probably am)
If I can not furnish my own wrongness
I'm sure someone will provide it for me.