Microsoft's Visual Studio: An Analogy
Microsoft's Visual Studio: An Analogy
If the concepts of classes, objects, properties, methods, and events are still a
little unclear, maybe an analogy will help. Consider an Automobile class.
When we say automobile, we are not referring to a particular auto, but we know
that an automobile has a make and model, a color, an engine, and a number of
doors. These elements are the properties of the Automobile class.
Each individual auto is an object, or an instance of the Automobile class.
Each Automobile object has its own settings for the available properties. For
example, each object has a Color property, such as MyAuto.Color _ Blue and
YourAuto.Color _ Red.
The methods, or actions, of the Automobile class might be Start,
SpeedUp, SlowDown, and Stop. To refer to the methods of a specific object of
the class, use MyAuto.Start and YourAuto.Stop.
The events of an Automobile class could be Arrive or Crash. In a VB program
you write procedures that specify the actions you want to take when a particular
event occurs for an object. For example, you might write a procedure for
the YourAuto.Crash event.
Note: Chapter 12 presents object-oriented programming in greater depth.