Peter,
In addition to the other comments (specifically the comments in the thread
Herfried gave).
Both Classes & Structures in VB.NET define a new type. Both types (Classes &
Structures) can have Functions, Procedures, Events, & Properties.
The primary difference between a Class & a Structure is that a Class is a
Reference type, it creates an Object (a value) that exists on the Heap.
While a Structure is a Value type, it creates a value that exists on the
stack or inline in another type. (A Class or Structure contains other
classes & structures).
A Class also supports Inheritance, a Structure does not (a Structure always
inherits from System.ValueType).
Where you can define:
Class Person
....Phone
...ID
...Address
End Class
Class Customer
Inherits Person
...Orders
End Class
Class Supplier
Inherits Person
End Class
Because Customer Inherits Person, Customer will have a Phone, ID & Address
via the Person class. Only Customers will have Orders. While Supplier will
also have a Phone, ID & Address via the Person class. Any routine that
accepts a Person object, you will be able to pass either a Customer or a
Supplier object.
Is this just a crutch of the old way of doing things or is there a good
reason to do this?
What is "this" referring to? You want to put your Functions, Procedures,
Events, & Properties inside either a Class or a Structure as this is
Encapsulation. Putting related Functions, Procedures, Events, & Properties
in a Module is encapsulation also, however its "weaker encapsulation " as
you can use those Functions, Procedures, Events, & Properties without
qualification. Encapsulation is one of the tenents of Object Oriented
Programming.
Hope this helps
Jay