Representing an object as a string means different things depending on the object. The .NET framework provides a function called ToString by which you can turn any object into a string. Every object has a ToString function because ToString is a function in System.Object . Every class in .NET has System.Object as its root parent. If you write a class like Account and a programmer creates an object of type Account and calls ToString , by default the system prints the name of the class, which isn't very useful. However, you can override the default implementation of the ToString function to return something more meaningful, like the Account's balance for example. (For a full explanation of overriding methods see Chapter 5, "Class Inheritance.") To implement your own ToString function:
Tip
|