e9cbf23ab5
이전 재구성 작업에서 Dev/ 폴더가 누락되었던 것을 반영. - Dev/Topic_Programming(중첩 폴더, 78개)은 Dev 자체 최상위 폴더들 (Architecture/Conventions/Engineering_Intelligence 등)과 완전 중복이라 제거. - Dev 최상위 엔지니어링 지식 폴더(Architecture/Conventions/Engineering_Intelligence/ Failure_Library/Generalized_Principles/Language/Pattern_Catalog/Platform_Guides/ Subsystems, 77개)는 이미 Topic_Programming/Topic_Programming에 더 최신 버전이 존재해 중복 제거(고유 콘텐츠 1개는 예외 처리하여 이동 보존). - Dev의 W3Schools 언어 튜토리얼 폴더(Topic_C/CPP/CSS/CSharp/HOWTO/HTML/Java/ JavaScript/PHP/Python/SQL/W3CSS, 1201개)는 전부 Topic_Programming 하위로 이동. - 에이전트 운영 상태(.astra/docs)는 그대로 유지, 콘텐츠 폴더만 정리. - Topic_Programming 최종 문서 수: 2784 → 3985.
4.3 KiB
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 |
|
B | 0.87 | 2026-07-04 | 2026-07-04 |
|
|
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 type —
int plusFunc(int x, int y)anddouble plusFunc(double x, double y)coexist under one name. [S1] - Overloading by parameter count —
int plusFunc(int x, int y)andint 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)
- 상위/루트: C++ Tutorial
- 관련 개념: CPP Function Default, CPP Function Multiple, CPP Constructors Overloading
- 참조 맥락: 함수 오버로딩 — 다중 매개변수(Function Multiple) 챕터로 이어짐, 생성자 오버로딩(Constructors Overloading) 챕터와 직접 연결.
📚 출처 (Sources)
- [S1] W3Schools — C++ Function Overloading — https://www.w3schools.com/cpp/cpp_function_overloading.asp
📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "C++ Function Overloading" page (Astra wiki-curation, P-Reinforce v3.1 format).