Using Methods
Class methods can be used as you would use any function or subroutine, except that you need a valid object on which to invoke the method. Use the dot-notation to invoke the method and place the parameters (if any) in parentheses after the method name. If the method is a function, you can assign the result value to a variable of the appropriate type or use the function in an expression.
You have probably noticed that the properties and methods are relatively similar from the implementation point of view. For example you could easily rewrite the Horse class presented previously to replace all properties with functions and subroutines, as shown in the example:
Public Class Horse Private m_name As String Private m_color As String Private ...
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.