Вопрос

I am currently reading this article from MSDN (which is also here). As a newbie, I can't figure out why there is an override method within an abstract class:

public override string ToString()
{
    return Id + " Area = " + string.Format("{0:F2}",Area);
}

I thought override is used to provide/override implementation after extending from an abstract or virtual class, but I don't understand why there's an override method within an abstract class.

Это было полезно?

Решение

All classes derived from class System.Object (ultimate base class of all classes in the .NET Framework).

Class Shape in the example is overriding ToString() method from class System.Object.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top