1. Trang chủ
  2. » Công Nghệ Thông Tin

Ebook Fundamentals of C++ programming Part 2

349 367 0

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

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 349
Dung lượng 11,54 MB

Nội dung

(BQ) Part 2 book Fundamentals of C++ programming has contents Standard C++ classes, custom objects, fine tuning objects, building some useful classes, inheritance and polymorphism, memory management, generic programming, the standard template library, associative containers, handling exceptions,... and other contents.

377 Chapter 13 Standard C++ Classes In the hardware arena, a desktop computer is built by assembling • a motherboard (a circuit board containing sockets for a processor and assorted supporting cards), • a processor, • memory, • a video card, • an input/output card (USB ports, parallel port, and mouse port), • a disk controller, • a disk drive, • a case, • a keyboard, • a mouse, and • a monitor (Some of these components like the I/O, disk controller, and video may be integrated with the motherboard.) The video card is itself a sophisticated piece of hardware containing a video processor chip, memory, and other electronic components A technician does not need to assemble the card; the card is used as is off the shelf The video card provides a substantial amount of functionality in a standard package One video card can be replaced with another card from a different vendor or with another card with different capabilities The overall computer will work with either card (subject to availability of drivers for the operating system) because standard interfaces allow the components to work together Software development today is increasingly component based Software components are used like hardware components A software system can be built largely by assembling pre-existing software building blocks C++ supports various kinds of software building blocks The simplest of these is the function that we investigated in Chapter and Chapter A more powerful technique uses built-in and user designed software objects ©2017 Richard L Halterman Draft date: January 30, 2017 378 13.1 STRING OBJECTS C++ is object-oriented It was not the first OO programming language, but it was the first OO language that gained widespread use in a variety of application areas An OO programming language allows the programmer to define, create, and manipulate objects Variables representing objects can have considerable functionality compared to the primitive numeric variables like ints and doubles Like a normal variable, every C++ object has a type We say an object is an instance of a particular class, and class means the same thing as type An object’s type is its class We have been using the std::cout and std::cin objects for some time std::cout is an instance of the std::ostream class—which is to say std::cout is of type std::ostream std::cin is an instance of the std::istream class Code that uses an object is a client of that object; for example, the following code fragment std::cout

Ngày đăng: 16/05/2017, 16:20