R
Robbie Hatley
in a message in this group, concerning ways of constructing
objects:
So, Tom (or anyone who knows something about this issue):
You're saying I should construct objects like this:
MyType Blat = MyType();
Instead of:
MyType Blat;
What's the difference? Why would the former provide
"default initialization" but the latter not?
As for "in generic code", I tried using former form
inside a template class and got the error message
"ISO C++ forbids initialization of member Blat".
But the latter form worked OK.
So I'm just wondering what this "T t = T()" business
is all about.
--
Cheers,
Robbie Hatley
Tustin, CA, USA
email: lonewolfintj at pacbell dot net
web: home dot pacbell dot net slant earnur slant
objects:
Yup, that's the best plan, but in generic code where you want default
initialization but don't know the type, you should probably do:
T t = T();
So, Tom (or anyone who knows something about this issue):
You're saying I should construct objects like this:
MyType Blat = MyType();
Instead of:
MyType Blat;
What's the difference? Why would the former provide
"default initialization" but the latter not?
As for "in generic code", I tried using former form
inside a template class and got the error message
"ISO C++ forbids initialization of member Blat".
But the latter form worked OK.
So I'm just wondering what this "T t = T()" business
is all about.
--
Cheers,
Robbie Hatley
Tustin, CA, USA
email: lonewolfintj at pacbell dot net
web: home dot pacbell dot net slant earnur slant