static void ExtendedSimpleBox() { Console.WriteLine("InheritedBox"); ExtendedBox box = new ExtendedBox(); Console.WriteLine("The inherited has a volume of {0}", box.GetVolume()); }
static void ExtendedSimpleBoxWithTypeCast() { Console.WriteLine("InheritedBox"); ExtendedBox box = new ExtendedBox(10, 10, 10); Console.WriteLine("The inherited has a volume of {0}", box.GetVolume()); Console.WriteLine("The ExtendedBox has a double volume of {0}", box.GetDoubleVolume()); Box newBox = box as Box; Console.WriteLine("The Box newBox, casted from box ExtendedBox has a volume of {0}", newBox.GetVolume()); }