Structures


The syntax for writing a structure is as follows:

  [attribute_list] [Partial] [accessibility] [Shadows] _  Structure name[(Of type_list)]     [Implements interface]     statements End Structure 

The structure’s attribute_list, Partial, accessibility, Shadows, type_list, and Implements statements are the same as those for classes. See the previous section for details.

The differences between a structure and a class are:

  • Structures cannot use the MustInherit or NotInheritable keyword (because you cannot inherit from a structure).

  • Structures cannot use the Inherits clause.

  • Structures must contain at least one instance variable or event, which may be private. Strangely, a property procedure is not enough.

  • Structures are value types, while classes are reference types. See Chapter 16 for information on the consequences of this difference.




Visual Basic 2005 with  .NET 3.0 Programmer's Reference
Visual Basic 2005 with .NET 3.0 Programmer's Reference
ISBN: 470137053
EAN: N/A
Year: 2007
Pages: 417

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net