dayuloli
dayuloli

Reputation: 17051

Override method within abstract class

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.

Upvotes: 2

Views: 252

Answers (1)

John Woo
John Woo

Reputation: 263883

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.

Upvotes: 3

Related Questions