Code Trivia #5
Posted
by João Angelo
on Exceptional Code
See other posts from Exceptional Code
or by João Angelo
Published on Wed, 13 Oct 2010 21:21:24 +0000
Indexed on
2010/12/06
16:59 UTC
Read the original article
Hit count: 610
A quick one inspired by real life broken code. What’s wrong in this piece of code?
class Planet { public Planet() { this.Initialize(); } public Planet(string name) : this() { this.Name = name; } private string name = "Unspecified"; public string Name { get { return name; } set { name = value; } } private void Initialize() { Console.Write("Planet {0} initialized.", this.Name); } }
© Exceptional Code or respective owner