{ public class Control { private int top; private int left; public Control(int top, int left) { top = top; left = left; } public void DrawControl() { Console.WriteLine("Drawing Control at {0}, {1}", top, left); } } public class ListBox: Control { private string mListBoxContents; public ListBox(int top, int left, string theContent): base(top,left) { mListBoxContents = theContent; } public new void DrawControl() { base.DrawControl(); Console.WriteLine("Writing string to the ListBox: {0}", mListBoxContents); } } public class Tester { public static void Main() { Control myControl = new Control (5,10); myControl.DrawControl(); ListBox lb = new ListBox (20, 30, "Hello World"); lb.DrawControl(); } } }
classtester.Control
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)