Chapter 25. Generics


...our special individuality, as distinguished from our generic humanity.

Oliver Wendell Holmes, Sr.

Every man of genius sees the world at a different angle from his fellows.

Havelock Ellis

Born under one law, to another bound.

Lord Brooke

Objectives

In this chapter you will learn:

  • To create generic methods that perform identical tasks on arguments of different types.

  • To create a generic Stack class that can be used to store objects of any class or interface type.

  • To understand how to overload generic methods with non-generic methods or with other generic methods.

  • To understand the New constraint of a type parameter.

  • To apply multiple constraints to a type parameter.

  • The relationship between generics and inheritance.

Outline

25.1 Introduction

25.2 Motivation for Generic Methods

25.3 Generic Method Implementation

25.4 Type Constraints

25.5 Overloading Generic Methods

25.6 Generic Classes

25.7 Notes on Generics and Inheritance

25.8 Wrap-Up



Visual BasicR 2005 for Programmers. DeitelR Developer Series
Visual Basic 2005 for Programmers (2nd Edition)
ISBN: 013225140X
EAN: 2147483647
Year: 2004
Pages: 435

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net