SUMMARY

A class abstracts the properties and behaviors of a set of objects to form a template that you can use to make objects that implement those properties and behaviors. After you define the class, you can make many instances of it, and they will all have the features defined by the class.

Generics take abstraction one level higher. A generic class abstracts the features of a set of classes defined for any given data types. It determines the properties and methods that any class in the generic group provides. After you define the generic class, you can easily make classes that work with different data types but that all provide the common set of features defined by the generic.

By defining common functionality, generic classes let you reuse code to perform similar actions for different data types. By allowing you to parameterize the class instances with a data type, they let you build strongly typed classes quickly and easily. That, in turn, lets Visual Basic provide IntelliSense to make programming faster and easier.

Together these benefits — easier code reuse, strong typing, and IntelliSense support — help you write, test, debug, and maintain code more easily.

The programs described in this book so far are relatively self-contained. They take input from the user, perform some calculations, and display the results on the program’s forms.

The chapters in the next part of the book explain ways a program can interact with the system. Chapter 27, “Printing,” explains how to generate ...

Get Visual Basic 2012 Programmer's Reference 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.