/* C# Programming Tips & Techniques by Charles Wright, Kris Jamsa Publisher: Osborne/McGraw-Hill (December 28, 2001) ISBN: 0072193794 */ namespace nsInherit { using System; public class clsMainInherit { static public void Main () { clsDerived derived = new clsDerived(); derived.Property = 42; derived.ShowField(); } } // // Define a base class with a private field and a public Property class clsBase { private int m_Field; public int Property { get {return (m_Field);} set {m_Field = value;} } public void ShowField () { Console.WriteLine ("The value of m_Field is " + m_Field); } } // // Define a derived class that inherits from the clsBase class clsDerived : clsBase { // For now, the derived class needs no members } }