Flashcards
COMP 206 Unit 7: Function Overloading and Default Arguments
Flashcards do conjunto (9)
- 1function 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 - 2overloading- single word has multiple meanings
- allows specification of more than one function of the same name in the same scope - 3type-safe linkage- enforces right number and type of parameters passed at link time
- safety net if you mis-declare a function - 4union- similar to structure
- defines single location that can be given many different member names - 5union vs class/structure1. 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 - 6default argumentvalue given in declaration that compiler automatically inserts if you don't provide value in function call
- 7placeholder 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 - 8overloading over default arguments1. 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 - 9default arguments over overloading1. 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
Informações
- Descrição
- University-level C++ COMP 206 FlashCards sobre COMP 206 Unit 7: Function Overloading and Default Arguments, criado por Adriana Vincelli-Joma em 16-09-2021.
- Criado por
- Adriana Vincelli-Joma · set 2021
- Atualizado
- 16 set 2021
- Visualizações
- 24
- Tags
- Avaliação