StudyGraph
Procedural Programming with C++ Explainer

Two Functions, One Name: Overloading in C++

C++ lets you write three functions all called print. How does it choose?

Lesson notes

Key points

Definitions

Function overloading
Same function name, different number or types of parameters; the compiler picks one per call.

Takeaway: Overloads differ by parameters, never by return type alone.

Quick check: Which pair is NOT a valid overload?
  1. f(int) and f(double)
  2. f(int) and f(int, int)
  3. int f(int) and double f(int)

OverloadingOverload resolutionReturn type rule

Lessons like this, for your syllabus.

Short narrated study videos written for your course, level and exam. Free to start.

Get lessons for your own syllabus