Join Bill Weinman for an in-depth discussion in this video Overloading function names, part of C++ Essential Training.
- [Instructor] In C++, it's possible…to have different functions with the same name.…The compiler selects which function to called based…on the entire function signature,…not just the function name.…This behavior is different than in C,…where each function must have a unique name.…Here I have a working copy of func-overload.cpp…from chapter five of the exercise files.…In C++, the function signature consists of the return type,…the function name, and the list of argument types.…
For example, this first function is volume,…returning double, taking one double argument.…And this function is volume, returning double,…taking two double arguments.…And this one is volume, returning double,…and taking three double arguments.…And you notice that I call them with one argument,…with two arguments, with three arguments,…and, when I run this, you see we get these results.…
The cube of 2.0, the cylinder of two and two,…and the cuboid of two, three, and four.…And you'll notice that each of these has that…in their printf, so we're calling the correct functions,…
Author
Released
12/19/2018- Setting up Xcode and Visual Studio
- Statements and expressions
- Variables
- Primitive arrays and strings
- Conditionals
- Loops
- Data types
- Operators
- Functions
- Classes and objects
- Templates
- Standard Library and Standard Template Library
Skill Level Intermediate
Duration
Views
Related Courses
-
Learning C++ Pointers
with Peggy Fisher53m 55s Intermediate -
Learning C++
with Erin Colvin2h 26m Beginner
-
Introduction
-
About this course1m 2s
-
Using the exercise files1m 10s
-
What is C++?4m 7s
-
-
1. Installation
-
2. Basic Syntax
-
Anatomy of a C++ program8m 43s
-
Statements and expressions3m 23s
-
Identifiers2m 23s
-
Defining variables3m 6s
-
Pointers4m 29s
-
References3m 27s
-
Primitive arrays3m 11s
-
Primitive strings3m 58s
-
Conditionals5m 6s
-
The branching conditional2m 55s
-
Iterating with for4m 42s
-
Range-based for loop3m 41s
-
Using stdout6m 58s
-
3. Data Types
-
Overview of data types3m 9s
-
Integer types2m 26s
-
Integer sizes6m 7s
-
Fixed-size integers4m 7s
-
Floating point types5m 41s
-
Characters and strings3m 53s
-
Character-escape sequences3m 40s
-
Qualifiers6m 1s
-
References5m 43s
-
Structured data2m 23s
-
Bit fields2m 45s
-
Enumerations3m 55s
-
Unions2m 47s
-
Defining types with typedef2m 22s
-
The void type2m 23s
-
The auto type3m 24s
-
-
4. Operators
-
Common operators2m 54s
-
Logical operators2m 17s
-
Bitwise operators3m 29s
-
Ternary conditional operator1m 47s
-
Dynamic memory operators7m 14s
-
Type cast3m 14s
-
Using sizeof4m
-
Using typeid2m 44s
-
Operator precedence2m 13s
-
-
5. Functions
-
Overview of C++ functions3m 32s
-
Creating a function3m 20s
-
Passing values to a function6m 13s
-
Using function pointers6m 22s
-
-
6. Classes and Objects
-
Defining a class3m 32s
-
Data members3m 56s
-
Function members6m 44s
-
Constructors and destructors6m 10s
-
Overloading operators6m 34s
-
7. Templates
-
Understanding templates2m 48s
-
Template functions4m 42s
-
Template classes3m 42s
-
-
8. Standard Library
-
File I/O4m 45s
-
Binary files4m 22s
-
File management4m 11s
-
Unformatted character I/O5m 57s
-
Formatted character I/O3m 34s
-
String functions5m 2s
-
Handling system errors2m 33s
-
9. Standard Template Library (STL)
-
Overview of the STL2m 25s
-
Vectors3m 56s
-
Strings3m 33s
-
I/O streams8m 3s
-
Handling exceptions4m 22s
-
-
Conclusion
-
Thank you1m 30s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Overloading function names