MFC Programmer's SourceBook : Thinking in C++
Bruce Eckel's Thinking in C++, 2nd Ed Contents | Prev | Next

answers:

  1. 1. Why is function overloading absolutely necessary in C++?

    A: Because objects must be initialized through constructors, which have the same name as the class. You may need to initialize an object in more than one way, so you must be able to overload the constructor by using it's name more than once.

  2. 2. How do you prevent global names from being mangled? That is, how do you bring global names in so you can use existing C libraries without worrying that their names will get mangled, and the linker won't be able to find them as a result?
  3. 3. What is the difference between function overloading and default arguments?
Make vartype a regular and public enumeration (with no instance) and modify print( ) so it requires a vartype argument to tell it what to do.

Contents | Prev | Next


Go to CodeGuru.com
Contact: webmaster@codeguru.com
© Copyright 1997-1999 CodeGuru