COMP 206 Unit 7: Function Overloading and Default Arguments

Description

University-level C++ COMP 206 Flashcards on COMP 206 Unit 7: Function Overloading and Default Arguments, created by Adriana Vincelli-Joma on 16/09/2021.
Adriana Vincelli-Joma
Flashcards by Adriana Vincelli-Joma, updated more than 1 year ago
Adriana Vincelli-Joma
Created by Adriana Vincelli-Joma almost 3 years ago
2
0

Resource summary

Question Answer
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
Show full summary Hide full summary

Similar

COMP 206 Unit 11: Operator Overloading
Adriana Vincelli-Joma
COMP 206 Unit 9: Name Control
Adriana Vincelli-Joma
COMP 206 Unit 6: Initialization and Cleanup
Adriana Vincelli-Joma
COMP 206 Unit 13: Inheritance and Composition
Adriana Vincelli-Joma
COMP 206 Unit 5: Hiding the Implementation
Adriana Vincelli-Joma
COMP 206 Unit 12: Dynamic Object Creation
Adriana Vincelli-Joma
COMP 206 Unit 8: Constants
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
HIST 404: Unit 4 Science in the Renaissance
Adriana Vincelli-Joma
HIST 404: Unit 9 Discovering DNA
Adriana Vincelli-Joma