1. Trang chủ
  2. » Biểu Mẫu - Văn Bản

Lecture Data structures and other objects using C++ - Chapter 3: Container classes - Trường Đại học Công nghiệp Thực phẩm Tp. Hồ Chí Minh

10 6 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 546,74 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

A  container class  container class  is a data  is a data  type that is capable of  type that is capable of  holding a collection of  holding a collection of  items.. In C++, container c[r]

Trang 1

A container class is a data  type that is capable of 

holding a collection of  items

In C++, container classes  can be implemented as a  class, along with member  functions to add, remove,  and examine items

Container Classes

Data Structures

and Other Objects

Using C++

Trang 2

For the first example,  think about a bag

Trang 3

For the first example,  think about a bag

Inside the bag are 

some numbers

Trang 4

When you first begin 

to use a bag, the bag 

will be empty

We count on this to be 

the initial state of any 

bag that we use

THIS BAG IS EMPTY.

Trang 5

Numbers may be 

inserted into a bag

I AM PUTTING THE NUMBER 4 INTO THE BAG.

Trang 6

Numbers may be 

inserted into a bag

THE 4 IS

IN THE BAG.

Trang 7

Numbers may be 

inserted into a bag

The bag can hold 

many numbers

NOW  I'M PUTTING ANOTHER NUMBER IN  THE BAG ­­

AN 8.

Trang 8

Numbers may be 

inserted into a bag

The bag can hold 

many numbers

THE 8 IS ALSO IN THE BAG.

Trang 9

Numbers may be 

inserted into a bag

The bag can hold 

many numbers

We can even insert 

the same number 

PUTTING A SECOND 4 

IN THE BAG.

Trang 10

Numbers may be 

inserted into a bag

The bag can hold 

many numbers

We can even insert 

the same number 

more than once NOW THE BAG HAS

TWO 4'S AND AN 8

Ngày đăng: 01/04/2021, 19:25

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

🧩 Sản phẩm bạn có thể quan tâm