Methods (for those learning Visual Basic)
The last thing we'll talk about in this lesson is Methods, which is an object oriented way to refer to procedures (or functions). These terms are synonymous, but you'll sound cooler if you say Methods from now on rather than procedures or functions. There are still two different types of procedures -- I mean -- methods: there are Sub Procedures and Functions.
Public Function Drive() as string
if m_make = "Oldsmobile" then
return "Chicago" else
return "Toledo" end if
Methods can be either Private or Public scope. Many times, you'll want Private methods to be used as helper functions or utilities that hide how the class does its work. Ideally, classes are like mysterious "black boxes" to the code that calls them. You know nothing about how the object works except for the Public properties and methods, and that is good. This is known as "Encapsulation" in Object Oriented programming terminology.
Supplemental Readings for the Express Edition Videos Copyright © 2005 LearnVisualStudio.NET