Defining Structures and Classes

We know that classes are reference types and structures are value types, literally derived from the System.ValueType. We also know that structures have replaced the type construct from VB6. What may not be so obvious is that both classes and structures support fields, properties, methods, constructors, and events. It also may not be immediately apparent that structures support only private or public members.

The structure is more like the C or C++ struct construct than it is like the VB6 type construct. However, because the VB6 type construct no longer exists, structure is the closest (and intended) replacement.

This section demonstrates how to declare each type of member that you can define in structures and classes. ...

Get Visual Basic® .NET Power Coding now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.