O'Reilly logo

Real World XML Web Services: For VB and VB .NET Developers by Yasser Shohoud

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

2.7. Type Substitution

You've seen how XSD supports type derivation through restriction, extension, and list. XSD also supports type substitution: the ability to substitute an element of a derived type in a place where an element of the base type is expected. This maps nicely to how you use interface implementation in VB 6/COM (limited to one interface) and inheritance in VB .NET. For example, consider two VB .NET classes called IceCream and Cake, which both inherit from Dessert as shown in Listing 2.3. The DessertMenu class in Listing 2.3 contains three fields named Item1, Item2, and Item3, each of type Dessert. At runtime, DessertMenu's constructor puts IceCream objects in both Item1 and Item2 and a Cake object in Item3.

Listing 2.3. An example ...

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