Files
2nd/10_Wiki/Dev/Topic_CSharp/CSharp_Method_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
csharp-method-overloading C# Method Overloading Programming_Language draft conceptual
overload same name different parameters
C# 메서드 오버로딩
B 0.83 2026-07-04 2026-07-04
csharp
programming-language
w3schools
methods
overloading
https://www.w3schools.com/cs/cs_method_overloading.php

CSharp Method Overloading

🎯 한 줄 통찰 (One-line insight)

Method overloading in C# (PlusMethod(int, int) and PlusMethod(double, double) sharing one name) is conceptually and syntactically identical to C++'s function overloading already covered in Topic_CPP — same rule ("as long as the number and/or type of parameters are different"), same motivating example structure (separately-named PlusMethodInt/PlusMethodDouble refactored into one overloaded PlusMethod) — reconfirming that C#'s object-oriented mechanics inherited directly from C++ rather than diverging, unlike the parameter-passing extensions (named arguments) covered in the immediately preceding chapter. [S1]

🧠 핵심 개념 (Core concepts)

  • Method overloading — multiple methods sharing the SAME name but differing in number and/or type of parameters. [S1]
  • Compiler resolves by signature — the compiler picks the correct overload based on the argument types/count supplied at the call site. [S1]
  • Motivation — avoids needing distinctly-named methods (PlusMethodInt, PlusMethodDouble) for functionally identical operations across different types. [S1]

📖 세부 내용 (Details)

  • Before overloading (distinct names): static int PlusMethodInt(int x, int y) { return x + y; } static double PlusMethodDouble(double x, double y) { return x + y; }. [S1]
  • After overloading (shared name): static int PlusMethod(int x, int y) { return x + y; } static double PlusMethod(double x, double y) { return x + y; } — called as PlusMethod(8, 5) (resolves to int version) and PlusMethod(4.3, 6.26) (resolves to double version). [S1]
  • General signature examples cited: int MyMethod(int x), float MyMethod(float x), double MyMethod(double x, double y) — all valid overloads of MyMethod. [S1]

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

  • C++의 함수 오버로딩과 개념·문법이 동일: 매개변수 개수/타입만 다르면 같은 이름을 여러 메서드가 공유할 수 있다는 규칙과 예제 구성 방식이 Topic_CPP의 Function Overloading 챕터와 차이가 없다는 점이 확인됨 — 이전 챕터(Named Arguments)의 C/C++ 대비 확장과는 달리, 오버로딩은 C++에서 그대로 계승된 메커니즘. [S1]

🛠️ 적용 사례 (Applied in summary)

서로 다른 이름의 두 메서드(PlusMethodInt/PlusMethodDouble)를 하나의 오버로드된 PlusMethod로 리팩터링하는 예제가 원문에서 직접 실전 활용 사례로 제시됨. [S1]

💻 코드 패턴 (Code patterns)

Overloading the same method name for different parameter types (C#):

static int PlusMethod(int x, int y)
{
    return x + y;
}
static double PlusMethod(double x, double y)
{
    return x + y;
}

static void Main(string[] args)
{
    int myNum1 = PlusMethod(8, 5);        // resolves to int version
    double myNum2 = PlusMethod(4.3, 6.26); // resolves to double version
}

검증 상태 및 신뢰도

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

🔗 지식 그래프 (Knowledge Graph)

📚 출처 (Sources)

📝 변경 이력 (Change history)

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