- Shopping Bag ( 0 items )
What is this book about?
Visual C++ 6.0 was released in 1998 as a component of Visual Studio 6.0. For three years, until the launch of Visual Studio .NET to support the .NET Framework, it was Microsoft's premier development product. Now five service packs old, version 6.0 remains the environment of choice for many developers who haven't yet made the move to .NET. If your aim is to learn how to program in C++ on the Windows platform, with all ...
What is this book about?
Visual C++ 6.0 was released in 1998 as a component of Visual Studio 6.0. For three years, until the launch of Visual Studio .NET to support the .NET Framework, it was Microsoft's premier development product. Now five service packs old, version 6.0 remains the environment of choice for many developers who haven't yet made the move to .NET. If your aim is to learn how to program in C++ on the Windows platform, with all the help offered by the Visual Studio interface, Visual C++ 6.0 remains a sound choice.
What does this book cover?
Beginning Visual C++ 6 can be broken down into four sections. The first is a fast-paced but thorough tutorial to the C++ language, punctuated with interesting and worthwhile example programs. After that, you'll learn about object orientation with C++, and how this relates to Windows programming - the section ends with the design and implementation of a sizable class-based C++ application.
The third part of the book walks the reader through creating Windows applications using the Microsoft Foundation Classes (MFC). This includes the following:
To illustrate the theory, this section also includes the complete implementation of a simple but fully-featured drawing application. The final section comprises a grounding in programmatic database access, an introduction to Microsoft's Component Object Model (COM), and examples of how to create ActiveX controls using both MFC and the Active Template Library (ATL).
This book was voted Amazon.com's C++ Book of the Year in 1998. It contains countless examples for you to follow and experiment with, and there are challenging exercises and model solutions in every chapter.
Who is this book for?
This book is for anyone who wants to learn C++ and Windows programming with Microsoft Visual C++ 6.0. Although progress will be easier if you have some experience of a programming discipline, an adept newcomer will also succeed in taming object-oriented programming and writing real Windows applications.
Author Ivor Horton has revised his excellent Beginning Visual C++ 5 and updated it with the latest version of Microsoft's powerful Integrated Development Environment (IDE) Visual C++ 6.0. The first half of this publication is a C++ language tutorial; the second half is a tutorial on Windows programming concepts and an introduction to Visual C++ 6.0 IDE. For best understanding, you should be familiar with programming concepts and have some understanding of Microsoft technologies such as ActiveX, MFC and OLE.
This chapter is about creating your own data types to suit your particular problem. This will go beyond the notion of collecting related variables together in a data structure that we saw in the last chapter. It is also about creating objects, the building blocks of object-oriented programming. An object can seem a bit mysterious to the uninitiated but, as we shall see in this chapter, an object is just an instance of one of your own data types.
In this chapter you will learn about:
Before we get into the language, syntax and programming techniques of classes, we'll start by considering how our existing knowledge relates to the concept of classes.
So far, we've learnt that C++ lets you create variables which can be any of a range of basic data types: int, long, double and so on. In the previous chapter, you saw how you could use the struct keyword to define a structure which, in turn, defined a variable representing a composite of several other variable types.
The variables of the basic types don't allow you to model real-world objects (or even imagine objects) adequately. It's hard to model a box interms of an int, for example. However, as we saw in the previous chapter, you could use the members of a struct to define extended attributes of your object. You could define variables, length, breadth and height to represent the dimensions of the box and bind them together as members of a Box structure, as follows:
With this definition of a new data type called Box, you can go ahead and define variables of this type just as you did with variables of the basic types. You can then create, manipulate and destroy as many Box objects as you need to in your program. This means that you can model objects using structs and write your programs around them. So--that's object-oriented programming all wrapped up then?
Well, not quite. You see, object-oriented programming (OOP) is based on a number of foundations (famously encapsulation, polymorphism and inheritance) and what we have seen so far doesn't quite fit the bill. Don't worry about what these terms mean for the moment--we'll be exploring that in the rest of this chapter and throughout the book.
The notion of a struct in C++ goes far beyond the struct in C--it incorporates the object-oriented notion of a class. This idea of classes, from which you can create your own data types and use them just like the native types, is fundamental to C++, and the new keyword class was introduced to describe this concept. The keywords struct and class are almost identical in C++, except for the access control to the members, which we will find out more about later in this chapter. The keyword struct is maintained for backwards compatibility with C.
We saw a little of what structs can do in the last chapter. In this chapter, we'll be looking at classes, and we'll see how much more we can do. Let's look at how we'd define a class for boxes:
Just like when we defined the Box structure, when we define CBox as a class we are essentially defining a new data type. The only differences here are the use of the keyword class instead of struct, and the use of the keyword public followed by a colon that precedes the definition of the members of the class. These are called data members of the class, since they are variables that store data.
We have also called the class CBox instead of Box. We could have called the class Box, but MFC adopts the convention of using the prefix c for all class names, so we might as well get into the habit now. MFC also prefixes data members of classes with m_ to distinguish them from other variables, so we'll use this convention too.
The public keyword is a clue as to the difference between a structure and a class. It just defines the members of the class as being generally accessible, in the same way as the members of the structures that we used in the last chapter were. The members of a struct, however, are public, by default. As you'll see a little later in the chapter, though, it's also possible to place the accessibility of the class members.
We can declare a variable, bigBox say, that is an instance of the CBox class like this:
This is exactly the same as declaring a variable for a struct, or indeed for any other variable type. Once we've defined the class CBox, the declaration of variables of this type is quite standard. The variable bigBox here is also referred to as an object or an instance of the class CBox.
The notion of class was invented by an Englishman to keep the general population happy It derives from the theory that people who knew their place and function in society would be much more secure and comfortable in life than those who did not. The famous Dane, Bjarne Stroustrup, who invented C++, undoubtedly acquired a deep knowledge of class concepts while at Cambridge University in England and appropriated the idea very successfully for use in his new language.
Class in C++ is similar to the English concept, in that each class usually has a very precise role and a permitted set of actions. However, it differs from the English idea, because class in C++ has largely socialist overtones, concentrating on the importance of working classes. Indeed, in some ways it is the reverse of the English ideal, because, as we shall see, working classes in C++ often live on the backs of classes that do nothing at all.
Operations on Classes
In C++ you can create new data types as classes to represent whatever kinds of objects you like. As you'll come to see, classes (and structures) aren't limited to just holding data; you can also define member functions or even operations that act between objects of your classes using the standard C++ operators. You can define the class CBox, for example, so that the following statements work and have the meanings you want them to have:
if(box1 > box2) // Fill the larger box
You could also implement operations as part of the CBox class for adding, subtracting or even multiplying boxes--in fact, almost any operation to which you could ascribe a sensible meaning in the context of boxes.
We're talking about incredibly powerful medicine here and it constitutes a major change in the approach that we can take to programming. Instead of breaking down a problem in terms of what are essentially computer-related data types (integer numbers, floating point numbers and so on) and then writing a program, we're going to be programming in terms of problem-related data types, in other words classes. These classes might be named CEmployee, or CCowboy, or CCheese, or CChutney, each defined specifically for the kind of problem that you want to solve, complete with the functions and operators that are necessary to manipulate instances of your new types.
Program design now starts with deciding what new application-specific data types you need to solve the problem in hand and writing the program in terms of operations on the specifics that the problem is concerned with, be it CCoffins or CCowpokes.
Let's summarize some of the terminology that we will be using when discussing classes in C++:
A class is a data type that you define. It can contain data elements which can either be variables of the basic types in C++, or other user-defined types. The data elements of a class may be single data elements, arrays, pointers, arrays of pointers of almost any kind, or objects of other classes, so you have a lot of flexibility in what you can include in your data type. A class can also contain functions which operate on objects of the class by accessing the data elements that they include. So, a class combines both the definition of the elementary data that makes up an object and the means of manipulating the data belonging to individual objects of the class.
The data and functions within a class are called members of the class. Funnily enough, the members of a class that are data items are called data members and the members that are functions are called function members or member functions. The member functions of a class are also sometimes referred to as methods, but we will not use this term in this book...
Posted January 21, 2005
I bought this book thinking it was for a beginner. However, I was unpleasantly surprised to find that this author teaches this subject much like some of the poor professors at colleges I know. They talk at you instead of helping you understand the subject. Once you sift through the many instances of dry humor, pomp and circumstance, you are left with an empty feeling that you have missed something. At first I though it was just me. However, after many re-reads of chapters, I found that this author continually rambles about one subject then abruptly moves to another in his examples. He then proceeds to further confuse you by mixing in other mathematical concepts that add noise to understanding what he meant to say in the first place. I would not recommend this book to a beginner, as this author makes every attempt to elude the concept of a beginner¿s book by adding worthless blather and his knowledge of other subjects to an already complicated subject. Add to that poorly written examples that ultimately add more confusion by adding unnecessary unexplained concepts, and you have the worst beginner¿s book I have read in awhile. This author's book, at best, has an intermediate audience in mind. However, even they would need to be suffering from ADD to follow this author¿s thought patterns.Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted April 16, 2004
The first half of the book teaches you C++, the second half is a useless, drawn-out tutorial that doesn't really teach you much about the Visual development environment. Cut-out everything after chapter 11 and use it as a decent C++ tutorial.Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted December 31, 2003
Ivor Horton is a hardcore program language instructor. He teaches programming languages in the manner that programming is still only taught in the finer colleges. As such, he demands a lot from his student, *ahem*, reader. By focusing on Command prompt programming during the beginning portion of the book, he forces the programming student to learn the fundamentals of programming as well as the language without getting bogged down in the flashy Visual IDE. Once the language basics are mastered, the additional chapters give the reader a suitable foundation to beginn working with and exploring the IDE on his or her own. I especially like the lessons at the end of each chapter, which, had dissappeared from programming textbooks for quite a while. These examples teach you the nuts and bolt of the language and begin the process of making you a competent programmer, not merely a code copier. As a programmer, one's knowledge and the languages one writes in are always evolving, so a solid foundation will get you much further than just copy-cat code that you do once and modify slightly to look different but with no really change in the functionality or understanding of the inner workings of the code. Once you have the rock solid foundation Ivor Horton lays for you, you will them be able to profitably explore other resources for examples and code which meets your specific needs. Notice how I say 'resources' and not 'books'. This is because after learning how to REALLY programm, as Ivor Horton, or any good teacher, teaches you, you will be able to make much better sense of other peoples codes and turorials as well as API's and other professional level resources. Many of these are free and often address your particular problem much more closely than any text book example. If you just want to 'learn to program' in order to write one or two applications, but you don't want to be bothered with the trouble of the programming language itself, this is NOT the book for you. In fact, this is not the programming language for you. Try something easier like Visual Basic. C and C++ are high powered and complex languages that are not mastered over night. However, if you spend the time and effort, you will be truly rewarded. As a programmer, student and professor of programming, I have often used Ivor Horton's texts to get a hold on a new language or to deepen my understanding of one I already knew. His academic approach is a refresshing and rewarding change to the shallow and unsatisfying throng of 'Learn to program NOW' books currently inundating the market.Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted September 16, 2003
I'm a programming instructor and this book was recommended by an obviously ill-informed fellow instructor. The book is ok for C++ but horrible for Visual C++. If you don't know Visual C++, when you finish with this book, you still won't know Visual C++. It was so bad, that my students and I had to find another book for the course. It's still a mystery to me why this book is so large. It's filled with NOTHING. It was not worth the money at all. I gave it 2 stars because I actually still use the book for C++ but it's certainly not a good Visual C++ book.Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted September 21, 2002
I'm not impressed by this book nor going to buy another title from this author. The book claims to teach you Visual C++. You'll spent first half of the book writing command line applications (you wouldn't need knowledge of VC++ 6.0 for this). The examples are fairly boring and repetitive, but acceptable and achieving the goal as C++ intro. A larger portion of the second half of the book concentrates on creating a "sketcher", a drawing application in VC++ 6.0 .... if you, for some reason, want to do program something more practical then a drawing application, get yourself a favor and buy a different book. Also, the book becomes fairly hard to follow in it¿s mentioned second half. Instead of having numerous smaller examples on various real life program tasks (which you modify for your needs or maybe even reuse elsewhere), the author just builds up his sketcher in chapter after chapter¿. You¿re getting bogged down into the loads of complicated and not clearly enough explained code. While in first half of the book author teaches you very C/C++ basics, here he suddenly assumes you know everything just as he does. Mr. Horton may be a skilled programmer, but definitely not a great VC++ teacher. This title says Beginning VC++, but should be called ¿How to build a sketcher application with limited features in VC++ for advanced programmers¿. There are few more things beside the sketcher in the second half of the book, and they are equally useless and complicated. Large book, no CD (code samples are downloadable though).Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted August 25, 2002
This book is flat out too long for its own good. The first half the book is language fundamentals, so it is all done in a DOS prompt, and that is not all that fun to do. You don¿t even see any Windows programming, except for a little blurb in chapter 7, until chapter 13, which is on page 523. I could not even get past chapter 5 because the book was so boring that I kept forgetting what I learned! And it is not like I did not try to read the book, I started it three times over, but still could not get past chapter 5. I am sure this book would be a good overview of the language once you knew it, but it does not do a good job at all of explaining the material in a fun and creative way. The thing that I was excited about was building the drawing program, so I might come back to this book later on.Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted August 20, 2002
This book came with the Visual C++ 6.0 Studio. The only thing it talks about is the MFC. Though it does show you how to make screens with eye candy, it does not even talk about the actual C++ language or how to hook the screens into programs. The other tutorial that came with the Studio only talked about the language (and not very well), but not how to attach the screens. The Sam's books are better that this.Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted February 2, 2002
Ok, my HS programming teacher told me to use this book when learning VC++. The book was almost no help. It did a horrible job of presenting why the commands did what the did, it just expected you to figure that out for yourself. Added to that, the book was lucky to get past bare-bones programming. If you learn how to do more than basic math and basic programming with this book, I'm amazed. My recomendation, find a better book.Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted August 9, 2001
Beginning any programming language is a pain. This book is down to earth and explains everything from start to finish line for line what exactly is going on. Some places it gets a bit fuzzy of what exactly is going on (when updating classes, it sometimes expects you to know where you are at) and you must follow the book page for page, Example code for example code. Several of the examples build later on examples use the previous examples that you should have made. (Sketcher and database programs, for example.) If you are completely new to programming, or C++, this book is the best I have read. Even with some background in c, visual C++ programming was hard to follow in other books (Sams teach yourself C++ in 21 days) Although I was a bit disappointed where some areas were left with not alot of detail (COM, Active X, etc) I did understand what the aurthor explained about it, it was beyond the scope of this beginner's book but he atleast touched based on the subjects which is a big help to jump into the next book(MFC COM) This book is well written and explains what you need to know, when you need to know it. Some things will not make sense at first, but as you go on, it will come clearer and more obvious. Not alot said about directx programming with windows, but overall the 'best' C++ book Ive read. It succeeded in giving me the knowledge that I need to move on into more advanced topics and Im sure it will for anyone, an excellent buy. Happy Programming !!!Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted July 6, 2001
This book delivers exactly what the title implies: A book for beginning Visual C++. Before reading I was already very familiar with C++ and very experienced with OOP, so it fit perfectly by refreshing C++ and then moving to Windows programming. I would strongly recommend it to anyone with the same background. However, this book is not a reference, which I think is completely okay since it was never intended to be. This is a cover-to-cover learning book and as such does an excellent job. As far as learning C++ itself, consider 'Ivor Horton's Beginning C++: The Complete Language.'Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted April 11, 2001
This book was purchased as recommended by a teacher for a Visual C++ class. I found it to be of very little help because it is set up to walk the reader through long drawn out tutorials and is really not a reference. On the occasions that I used this to reference some bit of code (dialog based), I was always dissapointed. I suppose if I had several weeks to sit down and go through the tutorials, it would have benefited me, but this is in no way a good reference just to pick up and get a quick answer.Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted July 4, 2001
Well C++ is not an easy language to learn, I think people who gave this book a 1-3 mean that they wanted learn C++ the day they got this book. This book is for people who already know some basics of programming and if you look carefully in the back of the book. There is a little chart telling you where to start! It's like a tree-diagram of where to get started. I do recommend this book to anyone who wants to get started.Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted February 11, 2001
This book is great for teaching classes, but fails in many other areas, such as dialog programming. Many of the functions recommended did not work as the book said. This is the book to get if you want to program a drawing program, but do not expect much more.Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted March 15, 2001
I did not have any background in C++ programming when I bought this book. I was hoping to learn quickly with some extra efford. It started allright. But after the fifth chapter I got lost. The examples are not realistic enough. All examples are adding, multiplying, and basic mathematics. I would like to see some basic real life programming. I am very much frustrated with this book.Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted July 25, 2000
Posted July 21, 2000
Posted June 16, 2000
I was timid at first due to the review that the one Air Force guy wrote, but I am a very strong supporter of this book now. I have had previous work with Pascal and Basic but VC++ is completly diffrent from those. This book walks you through the diffrent parts of VC++ and not only explains HOW to do it, but WHY. It also caters to the group of people who have no knowledge of C, C++, or VC++ so it is a great book for begginners. I read a bit of VC++ for Dummies and the book published by Microsoft for VC++. This one smokes them both. You want to learn VC++.... GET THIS BOOK!Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted May 11, 2000
Almost half of this book is spent teaching you standard C++. You don't even touch GUI code until chapter 13! Starting in chapter 13, you begin building a drawing program. From then on, every chapter builds on that drawing program. So you can't skip a single chapter or your program won't work! Now, let's be realistic here... how often do you need to create a DRAWING program??? If you're like most programmers, you need to know how to create STANDARD Windows applications (text editors, database front ends, etc.). So guess what!!! You're going to have to buy another book to learn how to do all that stuff (at least I had to). So save yourself the time and just buy another book instead.Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted April 12, 2000
Posted January 15, 2000
This book is clear, concise, and best of all organized. It moves perfectly for a beginner (like myself). I understand the concepts and don't feel overwhelmed by undefined or unpracticed code that finds its way into an example (like many other books). This book only uses code that it has gone over before in each example and excercise. I recommend this to ANY beginner that wants to know more about Visual C++ 6 and windows programming using C++. (I finally found the right book)Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.