Files
2nd/10_Wiki/Dev/Topic_CPP/CPP_Function_Overloading.md
T
Antigravity Agent 1cfd3bbb56 docs(10_Wiki): 위키 구조 정리 — 언어 튜토리얼 카테고리 폴더 제거 + 신규 자산 동기화
Topic_CSS/Topic_HTML/Topic_JavaScript/Topic_Prompt/Topic_Comfyui 등 기존 카테고리 폴더를 정리하고,
Topic_Graphic/Dev 등 신규 산출물과 Topics 내부 세션/메모리 기록을 동기화.
2026-07-05 00:10:59 +09:00

4.3 KiB

id, title, category, status, verification_status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, created_at, updated_at, review_reason, merge_history, tags, raw_sources, applied_in, github_commit
id title category status verification_status canonical_id aliases duplicate_of source_trust_level confidence_score created_at updated_at review_reason merge_history tags raw_sources applied_in github_commit
cpp-function-overloading C++ Function Overloading Programming_Language draft conceptual
same name different signature
overload resolution
C++ 함수 오버로딩
B 0.87 2026-07-04 2026-07-04
cpp
programming-language
w3schools
functions
overloading
https://www.w3schools.com/cpp/cpp_function_overloading.asp

CPP Function Overloading

🎯 한 줄 통찰 (One-line insight)

Function overloading is entirely absent from C — C requires a UNIQUE name per function (hence plusFuncInt/plusFuncDouble as the "without overloading" workaround), while C++ lets MULTIPLE functions share one name (plusFunc) as long as their parameter TYPE or COUNT differs, meaning the compiler determines which version to call based on the ARGUMENTS at each call site, not the function name alone — a genuinely new resolution mechanism C never had. [S1]

🧠 핵심 개념 (Core concepts)

  • Function overloading — multiple functions sharing ONE NAME, differentiated by parameter type and/or count. [S1]
  • Without overloading (the C-style workaround) — separate function names (plusFuncInt, plusFuncDouble) needed for logically identical operations on different types. [S1]
  • Overloading by typeint plusFunc(int x, int y) and double plusFunc(double x, double y) coexist under one name. [S1]
  • Overloading by parameter countint plusFunc(int x, int y) and int plusFunc(int x, int y, int z) coexist, differentiated purely by how many arguments are passed. [S1]

📖 세부 내용 (Details)

  • The C-style workaround requiring separate names: int plusFuncInt(int x, int y) { return x + y; } double plusFuncDouble(double x, double y) { return x + y; }. [S1]
  • The same logic unified via overloading: int plusFunc(int x, int y) { return x + y; } double plusFunc(double x, double y) { return x + y; } — the compiler picks the right one based on argument types. [S1]
  • Overloading by parameter count: int plusFunc(int x, int y) { return x + y; } int plusFunc(int x, int y, int z) { return x + y + z; }plusFunc(3, 7) calls the 2-parameter version, plusFunc(1, 2, 3) calls the 3-parameter version. [S1]

⚖️ 모순 및 업데이트 (Contradictions & updates)

  • C에는 전혀 없던 오버로딩 개념: C는 함수마다 고유한 이름이 필요하지만(plusFuncInt/plusFuncDouble처럼), C++는 매개변수의 타입이나 개수만 다르면 같은 이름을 여러 함수에 재사용할 수 있다는 점이 근본적으로 새로운 개념으로 확인됨. [S1]

🛠️ 적용 사례 (Applied in summary)

int과 double 두 타입에 대해 같은 덧셈 로직을 하나의 plusFunc 이름으로 통합하는 예제가 원문에서 직접 실전 활용 사례로 제시됨. [S1]

💻 코드 패턴 (Code patterns)

One function name overloaded for two different parameter types (C++):

int plusFunc(int x, int y) {
  return x + y;
}
double plusFunc(double x, double y) {
  return x + y;
}
int main() {
  int myNum1 = plusFunc(8, 5);        // calls the int version
  double myNum2 = plusFunc(4.3, 6.26); // calls the double version
  return 0;
}

검증 상태 및 신뢰도

  • 상태: draft
  • 검증 단계: conceptual
  • 출처 신뢰도: B (W3Schools — widely used educational reference, not a primary standards body)
  • 신뢰 점수: 0.87
  • 중복 검사 결과: 신규 생성 (New discovery)

🔗 지식 그래프 (Knowledge Graph)

📚 출처 (Sources)

📝 변경 이력 (Change history)

  • 2026-07-04: Initial draft synthesized from the W3Schools "C++ Function Overloading" page (Astra wiki-curation, P-Reinforce v3.1 format).