Free mag vol1 | Page 280

CHAPTER 6  UNDERSTANDING INHERITANCE AND POLYMORPHISM the Visual Studio Object Browser (via the View menu) and selecting the String class within the System namespace of the mscorlib.dll assembly. Notice in Figure 6-1 the use of the sealed keyword seen within the Summary window. Figure 6-1. The base class libraries define numerous sealed types, such as System.String Thus, just like the MiniVan, if you attempted to build a new class that extends System.String, you will receive a compile-time error: // Another error! Cannot extend // a class marked as sealed! class MyString : String {}  Note In Chapter 4, you learned that C# structures are always implicitly sealed (see Table 4-3). Therefore, you can never derive one structure from another structure, a class from a structure, or a structure from a class. Structures can only be used to model stand-alone, atomic, user-defined data types. If you want to leverage the isa relationship, you must use classes. 217