Sams Teach Yourself C in 21 Days

(singke) #1

Q&A ....................................................................................................................


Q Are functions the only thing that can be overloaded?
ANo. Operators can also be overloaded in C++. It is beyond the scope of this book
to explain operator overloading. You’ll learn tomorrow that operator overloading is
common when working with classes.
Q How are Boolean values (type boolvariables) different from the values stored
in a bit?
ABoolean values are stored in a single byte as either TrueorFalse. Only one
Boolean value can be stored in a single byte. A bit can also be trueorfalse(set
as being 0 or 1 ). There can be more than one bit in a single byte. In an 8-bit byte,
an 8-bit value can be stored; however, only one bool value can be stored.
Q Today’s lesson covered overloading functions and using inline functions. What
are member functions?
AMember functions are also a feature of C++ that are not available in C. Member
functions are a part of a class. Classes and member functions will both be covered
in detail in tomorrow’s lesson.
Q Can I use printf()andfprintf()in my C++ programs?
AAlthough you can use C functions in your C++ listings, it is not recommended.
Thecoutclass is much more streamlined than the bulky printf()functions. This
combined with the object-oriented nature of the coutobject make it a much more
appropriate choice. If you use printf(), you are moving away from creating an
object-oriented program.
Q What are a few recommended books to read to learn more about C++?
AThis book does not try to teach everything you need to know about C++. To learn
more, you can purchase a number of other books, including Sams Teach Yourself
C++ in 21 Daysby Jesse Liberty.

Workshop ............................................................................................................


The Workshop provides quiz questions to help you solidify your understanding of the
material covered and exercises to provide you with experience in using what you’ve
learned. Answers to the quiz are provided in Appendix F.

662 Bonus Day 2

37 448201x-Bonus2 8/13/02 11:18 AM Page 662

Free download pdf