/*
Learning C#
by Jesse Liberty
Publisher: O'Reilly
ISBN: 0596003765
*/
using System;
class Dog
{
privateint weight;
// constructor
public Dog(int weight)
{
this.weight = weight;
}
// override Object.ToString
public override string ToString()
{
return weight.ToString();
}
}
publicclass TesterOverride
{
staticvoid Main()
{
int i = 5;
Console.WriteLine("The value of i is: {0}", i.ToString());
Dog milo = new Dog(62);
Console.WriteLine("My dog Milo weighs {0} pounds", milo.ToString());
}
}