Visual Basic 2005 Structs

Structs are lightweight types that make fewer demands on the operating system and on memory than conventional classes. PowerDesigner models Visual Basic 2005 structs as classes with a stereotype of <<Structure>>.

For information about creating and working with classes, see Classes (OOM).

A struct can implement interfaces but does not support inheritance; it can contain events, variables, constants, methods, constructors, and properties.

In the following example, the struct contains two attributes and a constructor operation:



...
Public Class Point
 Protected Y As Integer
 Protected X As Integer
 Public Sub New()
  
 End Sub
End Class
...

Creating a Struct

You can create a struct in any of the following ways:
  • Use the Struct tool in the Visual Basic 2005 Toolbox.

  • Select Model > Struct Objects to access the List of Struct Objects, and click the Add a Row tool.

  • Right-click the model (or a package) in the Browser, and select New > Struct.

Struct Properties

Visual Basic 2005 struct property sheets contain all the standard struct tabs along with the following properties, located on the VB tab:

Property

Description

Explicit

Specifies the Explicit option directive for the struct declaration.

Shadows

Specifies that the struct redefines a struct defined in a parent struct.

Strict

Specifies the Strict option directive for the struct declaration.

Compare

Specifies the Compare option directive for the struct declaration.