Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
C++ For Dummies (2004) [eng].pdf
Скачиваний:
84
Добавлен:
16.08.2013
Размер:
8.09 Mб
Скачать

Introduction 5

In this section, I also introduce that most dreaded of all topics, the C++ pointer. If you don’t know what that means, don’t worry — you’ll find out soon enough.

Part III: Introduction to Classes

The plot thickens in this part. Part III begins the discussion of object-oriented programming. Object-oriented programming is really the reason for the exis­ tence of C++. Take the OO features out of C++, and you’re left with its prede­ cessor language, C. I discuss things such as classes, constructors, destructors, and making nachos (I’m not kidding, by the way). Don’t worry if you don’t know what these concepts are (except for nachos — if you don’t know what nachos are, we’re in big trouble).

Part IV: Inheritance

Inheritance is where object-oriented programming really comes into its own. Understanding this most important concept is the key to effective C++ pro­ gramming and the goal of Part IV. There’s no going back now — after you’ve completed this part, you can call yourself an Object-Oriented Programmer, First Class.

Part V: Optional Features

By the time you get to Part V, you know all you need to program effectively in C++. I touch on the remaining features of the language. Features such as file input/output, error-handling constructs, and templates are left to this part.

Part VI: The Part of Tens

What For Dummies book would be complete without The Part of Tens? Chap­ ter 29 shows you the top ten best ways to avoid introducing bugs into your programs, bugs that you would otherwise have to ferret out on your own.

Chapter 30 takes you through the most important tools and options in the Dev-C++ environment. Although Dev-C++ is not part of the C++ language, under­ standing these options enhances your programming experience.

6C++ For Dummies, 5th Edition

Icons Used in This Book

This is technical stuff that you can skip on the first reading.

Tips highlight a point that can save you a lot of time and effort.

This icon alerts you to examples and software that appear on this book’s CD-ROM.

Remember this. It’s important.

Remember this, too. This one can sneak up on you when you least expect it and generate one of those really hard-to-find bugs.

Where to Go from Here

Finding out about a programming language is not a spectator sport. I’ll try to make it as painless as possible, but you have to power up the ol’ PC and get down to some serious programming. Limber up the fingers, break the spine on the book so that it lies flat next to the keyboard (and so that you can’t take it back to the bookstore), and dive in.

Part I

Introduction to C++ Programming

In this part . . .

Both the newest, hottest flight simulator and the simplest yet most powerful accounting programs

use the same basic building blocks. In this part, you dis­ cover the basic features you need to write your killer application.

Chapter 1

Writing Your First C++ Program

In This Chapter

Finding out about C++

Installing Dev-CPP from the accompanying CD-ROM

Creating your first C++ program

Executing your program

Okay, so here we are: No one here but just you and me. Nothing left to do but get started. Might as well lay out a few fundamental concepts.

A computer is an amazingly fast but incredibly stupid machine. A computer can do anything you tell it (within reason), but it does exactly what it’s told — nothing more and nothing less.

Perhaps unfortunately for us, computers don’t understand any reasonable human language — they don’t speak English either. Okay, I know what you’re going to say: “I’ve seen computers that could understand English.” What you really saw was a computer executing a program that could meaningfully under­ stand English. (I’m still a little unclear on this computer-understanding-language concept, but then I don’t know that my son understands my advice, either, so I’ll let it slide.)

Computers understand a language variously known as computer language or machine language. It’s possible but extremely difficult for humans to speak machine language. Therefore, computers and humans have agreed to sort of meet in the middle, using intermediate languages such as C++. Humans can speak C++ (sort of), and C++ is converted into machine language for the com­ puter to understand.