You're viewing a comment by serenity and its responses.

serenity Permalink
June 18, 2010, 10:47

"If you made the constructor of A explicit, that would no longer be possible. It's always a good idea to make your constructors explicit to avoid accidental conversions."

Hm. I understood everything else clearly, but this has me stumped. Isn't "55" (without quotes, obviously) an int, which gets passed to a constructor expecting an int?

Comment Responses

June 18, 2010, 10:52

Oops, you're right! I am modifying the example.

gopi Permalink
October 30, 2012, 17:43

very useful post..

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "browser_224": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.