T
Tony Johansson
Hi!
You need to create a simple class or structure that contains only value
types.
You must create the class or structure so that it runs efficiently as
possible. You
must be able to pass the class or structure to a procedure without concern
that the
procedure will modify it.
Which of the following should you use ?
A reference class
or
A value structure
I don't fully understand what the sentence mean by saying "without concern
that the
procedure will modify it." Does they mean that the original passed argument
must not be changed or does it mean
that it doesn't matter if the procedure change the passed argument ?
My choice between a reference class and a value structure is the following.
If the original passed argument is not allowed to be changed we must choose
a struct.
If it doesn't matter if the passed argument is changed in the procedure I
would go for a class because then
the passing mechanism is more efficient because of passing only the refence.
//Tony
You need to create a simple class or structure that contains only value
types.
You must create the class or structure so that it runs efficiently as
possible. You
must be able to pass the class or structure to a procedure without concern
that the
procedure will modify it.
Which of the following should you use ?
A reference class
or
A value structure
I don't fully understand what the sentence mean by saying "without concern
that the
procedure will modify it." Does they mean that the original passed argument
must not be changed or does it mean
that it doesn't matter if the procedure change the passed argument ?
My choice between a reference class and a value structure is the following.
If the original passed argument is not allowed to be changed we must choose
a struct.
If it doesn't matter if the passed argument is changed in the procedure I
would go for a class because then
the passing mechanism is more efficient because of passing only the refence.
//Tony