When reading the tutorial of “Properties Tutorial” from MSDN.
I’m consused about the example.
How to define abstract properties. …
When I debug, I found each of the three override double Area() is invoked by ToString(); and ToString() is invoked default by the WriteLine() calls.
What’s the benefit calling this way?
I feel it is not a short way to override double Area().
public override string ToString()
{
return Id + " Area = " + string.Format("{0:F2}",Area);
}
The ToString/writeline methods are not related to overriding Area, it is a demonstration to show the use of an overriden property.