CompuServe Messages

C,C++ Books

    30-Mar-94 09:02:44
Sb: #40291-C,C++ Books
Fm: Jim Butterfield 73624,14
To: Patrick Walsh 74252,2750
You might think of C++ in two parts. First there are enhancements to the C language. These range all the way from an easy single-line comment (just start the line with //) to more elegant input/output [printf() replaced by cout, which in many cases will figure out what format is wanted for each variable]. In general, these make coding a little faster, although they don't tend to reduce the size of your final program. There are LOTS of these enhancement features. Second, you might say C++ is a "class" act; here's where it gets into object oriented stuff. If you know how C deals with structures, think along these lines: first, C++ can make certain parts of the structure "private" so that no outside code can look at these. Next, the structure can contain, not only data, but code, to handle parts of itself (especially those private bits). By the time we do all this, the "structure" may be renamed a "class". It works out this way: whereas in C, a program makes, loads, and changes a structure at will, in C++ it doesn't have access. It must make application to one of the embedded functions (say, "add an item", "find an item", "change an item", "delete an item") in order to interact with the structure (class) data. In particular, stuff like the links in a linked list will never be seen by "outside" code. And the calling program doesn't need to know everything that's in the data, or how it's organized; it just asks for what it wants. This type of Object Oriented Programming tends to encapsulate data into a separate module. Not just the data, of course: code can also be encapsulated in its own private module; C already does this to some extent with separate procedures. Trust this rather shallow outline will give you an idea of where C++ will take you. –Jim