CSharp examples for Custom Type:Inheritance
The ultimate base class in C# is Object.
The Object class is the root class in the .NET Framework class hierarchy.
using System;//w ww.j av a2s .com sealed class PI { public static float nbr; static PI() { nbr = 3.14159F; } static public float val() { return(nbr); } } class myApp { public static void Main() { Console.WriteLine("PI = {0}", PI.val()); Object x = new PI(); Console.WriteLine("ToString: {0}", x.ToString()); Console.WriteLine("Type: {0}", x.GetType()); Console.WriteLine("ToString: {0}", 123.ToString()); Console.WriteLine("Type: {0}", 123.GetType()); } }