Object-Oriented Programming Sample

To get samples and instructions for installing them, see the following:

  • Click Samples on the Visual Studio Help menu.

    For more information, see Locating Sample Files.

  • The most recent versions and the complete list of samples are available on the Visual Studio 2008 Samples Web site.

  • You can also locate samples on your computer's hard disk. By default, samples and a Readme file are copied to a folder under \Program Files\Visual Studio 9\Samples\. For Visual Studio Express Editions, all samples are located on the Internet.

To run this sample

  • Press F5.

Demonstrates

The project includes several class definitions. Customer is the base class, and contains only three properties. Four other classes are derived from the Customer class. Each inherits the properties of Customer, but adds another category of class member.

  • CustomerPropertySyntax is a modification of the Customer class that sets the AccountNumber property during construction. Once created, the AccountNumber cannot be changed.

  • CustomerWithConstructor is a modification of Customer that includes a constructor that sets all three properties during instantiation.

  • CustomerWithParameterizedProperty is a customization of Customer that adds a property that takes a parameter.

  • CustomerWithSharedMembers adds a shared property and a shared method to the Customer class.