Answers 875
F
- C can be used to do object oriented programming; however, it would be very com-
plex. C++ and Java both have object-oriented features built into them. If you are
going to do object-oriented programming, you are much better off using C++ or
Java. - No. Java can be thought of as C++ minus those features that cause unnecessary
complexity and the likelihood of errors. - For C++ the answer is yes—you have the option of using either procedural or
object-oriented techniques (or both) in a program. With Java, the answer is no. Java
requires the use of object-oriented techniques.
7.cout
8.System.out.println()
9.System.Console.WriteLine()
Answers for Bonus Day 2
Quiz
- True or False
- You should never use printf()in a C++ program.
- bool
- Variables in C++ can be declared at any point within a listing.
5.throw - Default values enable you to create a single function that can take a multiple num-
ber of parameters. Overloading functions allows you to create different functions
that take different data types or different numbers of parameters. - All three of these have the same number of parameters with the same data types;
therefore, none of these functions can be overlaid with each other.
8.int triangle( int side1 = 0, int side2 = 0, int side 3 = 0 );
This is a bit of a trick question. The definition of the inline function is true. The
compiler does not do this for every function specified as inline. The compiler may
choose to ignore the inline specifier if it doesn’t believe the resulting code will be
more efficient.
49 448201x-APP F 8/13/02 11:22 AM Page 875