Defining a Class in Visual Basic .NET
A class is a user-defined data type. Its declaration is similar to the declaration of structures. You can declare it as part of a module; however, due to the fact that classes tend to be much larger (have more lines of code) than structures, they are usually declared in separate files (using the same .vb extension).
Create a new console project and give it the suggestive name ClassExample1. From the Project menu select Add Class and change the filename from Class1.vb to Horse.vb. Enter the lines of code shown in bold in the following example:
Public Class Horse Public m_name As String Public m_color As String Public m_height As Single End Class
This is a class definition. Apparently there are no major differences ...
Get Visual Basic® .NET by Example 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.