O'Reilly logo

Microsoft®C# Programming for the absolute beginner by Andy Harris

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a New Object with the CritterName Program

You have begun to understand the benefits of OOP, but the real fun begins when you create your own objects. Although making the Critter program work without using OOP principles is possible, the point of this chapter is to show how to create objects, so that’s what you do next.

Figure 4.10 shows the output of the Critter Name program you create in this section.

Figure 4.10. This version of theCritter programfeatures a critterthat knows itsname.

Creating the Basic Critter

A critter is an object. Objects, as you recall, can have properties, methods, and events. An object has a class (which is like a recipe–it ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required