Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 9. Vectors > Vector Basics

9.1. Vector Basics

A Vector is an optimized kind of Array that is made to store and retrieve instances of the same class. It behaves almost identically to an Array, but the key difference is that it stores only one type of object, as you can see in Figure 9-1.

In the original Array, you can store all kinds of objects together. In a Vector, you store only one kind. In the preceding example, the Vector only stores instances of Shoe. In this chapter, you'll see when and why this can be useful. I'll also cover the other minor differences between the two data types.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint