3 ms·
Ah, that makes sense. Though technically you don't have to use the new keyword unless you want a heap allocated instance, something like HandleTheFoo(Foo(5))
by ryanmolden 14y ago
Ah, that makes sense. Though technically you don't have to use the new keyword unless you want a heap allocated instance, something like
HandleTheFoo(Foo(5));
or even
HandleTheFoo(Foo(otherFoo));
is perfectly cromulent with the constructor being marked explicit. But that is just me engaging in terminological quibbling, I get what you meant/said in spirit and don't disagree that people asking questions they don't have a deep understanding of themselves can only lead to fail.
- raganwald 14y agoThanks for the kind words. And the reminder about stack variables!!! I wasn’t trying to suggest that Ted didn’t have deep knowledge of C++, as we can see his fictional knowledge is far better than my distant memories. I was trying to suggest that he was engaging in copy-and-paste interviewing, and that it’s a bad idea for all of the same reasons copy-and-paste coding is a bad idea :-)