Thinking in C++ 2nd edition


Here is a brief description of the chapters contained in this book:
((0)) The evolluttiion off objjecttss.. When projects became too big and too complicated to easily maintain, the “software crisis” was born, saying, “We can’t get projects done, and if we can they’re too expensive!” This precipitated a number of responses, which are discussed in this chapter along with the ideas of object-oriented programming (OOP) and how it attempts to solve the software crisis. You’ll also learn about the benefits and concerns of adopting the language and suggestions for moving into the world of C++.

((1)) Datta abssttracttiion.. Most features in C++ revolve around this key concept: the ability to create new data types. Not only does this provide superior code organization, but it lays the ground for more powerful OOP abilities. You’ll see how this idea is facilitated by the simple act of putting functions inside structures, the details of how to do it, and what kind of code it creates.

((2)) Hiidiing tthe iimpllementtattiion.. You can decide that some of the data and functions in your structure are unavailable to the user of the new type by making them priivatte. This means you can separate the underlying implementation from the interface that the client programmer sees, and thus allow that implementation to be easily changed without affecting client code. The keyword cllassss is also introduced as a fancier way to describe a new data type, and the meaning of the word “object” is demystified (it’s a variable on steroids).

((3)) IIniittiialliizattiion & clleanup.. One of the most common C errors results from uninitialized variables. The constructor in C++ allows you to guarantee that variables of your new data type (“objects of your class”) will always be properly initialized. If your objects also require some sort of cleanup, you can guarantee that this cleanup will always happen with the C++ destructor.

((4)) Functtiion overlloadiing & deffaulltt argumenttss.. C++ is intended to help you build big, complex projects. While doing this, you may bring in multiple libraries that use the same function name, and you may also choose to use the same name with different meanings within a single library. C++ makes this easy with function overloading, which allows you to reuse the same function name as long as the argument lists are different. Default arguments allow you to call the same function in different ways by automatically providing default values for some of your arguments.

((5)) IInttroducttiion tto iiossttreamss.. One of the original C++ libraries – the one that provides the essential I/O facility – is called iostreams. Iostreams is intended to replace C’s ssttdiio..h with an I/O library that is easier to use, more flexible, and extensible – you can adapt it to work with your new classes. This chapter teaches you the ins and outs of how to make the best use of the existing iostream library for standard I/O, file I/O, and in-memory formatting.

((6)) Conssttanttss.. This chapter covers the consstt and vollattiille keywords that have additional meaning in C++, especially inside classes. It also shows how the meaning of consstt varies inside and outside classes and how to create compile-time constants in classes.

((7)) IInlliine ffuncttiionss.. Preprocessor macros eliminate function call overhead, but the preprocessor also eliminates valuable C++ type checking. The inline function gives you all the benefits of a preprocessor macro plus all the benefits of a real function call.

((8)) Name conttroll.. Creating names is a fundamental activity in programming, and when a project gets large, the number of names can be overwhelming. C++ allows you a great deal of control over names: creation, visibility, placement of storage, and linkage. This chapter shows how names are controlled using two techniques. First, the ssttattiic keyword is used to control visibility and linkage, and its special meaning with classes is explored. A far more useful technique for controlling names at the global scope is C++’s namesspace feature, which allows you to break up the global name space into distinct regions.

((9)) Refferencess & tthe copy--conssttructtor.. C++ pointers work like C pointers with the additional benefit of stronger C++ type checking. There’s a new way to handle addresses; from Algol and Pascal, C++ lifts the reference which lets the compiler handle the address manipulation while you use ordinary notation. You’ll also meet the copyconstructor, which controls the way objects are passed into and out of functions by value. Finally, the C++ pointer-to-member is illuminated.

((10)) Operattor overlloadiing.. This feature is sometimes called “syntactic sugar.” It lets you sweeten the syntax for using your type by allowing operators as well as function calls. In this chapter you’ll learn that operator overloading is just a different type of function call and how to write your own, especially the sometimes-confusing uses of arguments, return types, and making an operator a member or friend.

((11)) Dynamiic objjectt creattiion.. How many planes will an air-traffic system have to handle? How many shapes will a CAD system need? In the general programming problem, you can’t know the quantity, lifetime or type of the objects needed by your running program. In this chapter, you’ll learn how C++’s new and dellette elegantly solve this problem by safely creating objects on the heap.

Download:
Link_1

No comments:

Post a Comment