CHAPTER 2 (Web hosting support) BUILDING C# APPLICATIONS 59 By

CHAPTER 2 BUILDING C# APPLICATIONS 59 By way of example, drag a new class from the Class Designer Toolbox onto your Class Designer. Name this class Car in the resulting dialog box. Now, using the Class Details window, add a public string field named petName (see Figure 2-26). If you now look at the C# definition of the Car class, you will see it has been updated accordingly: public class Car { // Public data is typically a bad idea; however, // it keeps this example simple. public string petName; } Add another new class to the designer named SportsCar. Now, select the Inheritance icon from the Class Designer Toolbox and click the top of the SportsCar icon. Without releasing the left mouse button, move the mouse on top of the Car class icon. If you performed these steps correctly, you have just derived the SportsCar class from Car (see Figure 2-27). Figure 2-26. Adding a field with the Class Details window Figure 2-27. Visually deriving from an existing class
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.

Leave a Reply