COMP 206 Unit 7: Function Overloading and Default Arguments

Descripción

University-level C++ COMP 206 Fichas sobre COMP 206 Unit 7: Function Overloading and Default Arguments, creado por Adriana Vincelli-Joma el 16/09/2021.
Adriana Vincelli-Joma
Fichas por Adriana Vincelli-Joma, actualizado hace más de 1 año
Adriana Vincelli-Joma
Creado por Adriana Vincelli-Joma hace alrededor de 3 años
4
0

Resumen del Recurso

Pregunta Respuesta
function name decoration - technique used to solve various problems caused by need to resolve unique names for programming entities - process used by C++ compilers give each function in your program unique name
overloading - single word has multiple meanings - allows specification of more than one function of the same name in the same scope
type-safe linkage - enforces right number and type of parameters passed at link time - safety net if you mis-declare a function
union - similar to structure - defines single location that can be given many different member names
union vs class/structure 1. union cannot be used as base class during inheritance; class can be used as base 2. structure allocates different memory location for all members; union allocates common memory location for all members
default argument value given in declaration that compiler automatically inserts if you don't provide value in function call
placeholder arguments - direct position of value in function - allows you to change function definition to use placeholder later, without changing all code where function is called
overloading over default arguments 1. default arguments shouldn't be used as flag upon which to conditionally execute code 2. function should be broken into two or more overloaded functions
default arguments over overloading 1. default arguments make it easier to write function calls and easier to read them 2. by defaulting all new arguments, you ensure that all client code using previous interface is not disturbed
Mostrar resumen completo Ocultar resumen completo

Similar

COMP 206 Unit 5: Hiding the Implementation
Adriana Vincelli-Joma
COMP 206 Unit 6: Initialization and Cleanup
Adriana Vincelli-Joma
COMP 206 Unit 8: Constants
Adriana Vincelli-Joma
COMP 206 Unit 9: Name Control
Adriana Vincelli-Joma
COMP 206 Unit 11: Operator Overloading
Adriana Vincelli-Joma
COMP 206 Unit 12: Dynamic Object Creation
Adriana Vincelli-Joma
COMP 206 Unit 13: Inheritance and Composition
Adriana Vincelli-Joma
COMP 206 Unit 3: The C in C++
Adriana Vincelli-Joma
GOVN 377 Unit 8: The Brave New World of Data Management and Manipulation
Adriana Vincelli-Joma
GOVN 377 Unit 6: New Technology: Data Mining, Matching, and Management
Adriana Vincelli-Joma
GOVN 377 Unit 7: Research and the Implications for Information Access adn Privacy
Adriana Vincelli-Joma