docs(10_Wiki): 위키 구조 정리 — 언어 튜토리얼 카테고리 폴더 제거 + 신규 자산 동기화
Topic_CSS/Topic_HTML/Topic_JavaScript/Topic_Prompt/Topic_Comfyui 등 기존 카테고리 폴더를 정리하고, Topic_Graphic/Dev 등 신규 산출물과 Topics 내부 세션/메모리 기록을 동기화.
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
---
|
||||
id: cpp-function-default
|
||||
title: "C++ Default Parameters"
|
||||
category: "Programming_Language"
|
||||
status: "draft"
|
||||
verification_status: "conceptual"
|
||||
canonical_id: ""
|
||||
aliases: ["optional parameter", "default argument value", "C++ 기본 매개변수"]
|
||||
duplicate_of: ""
|
||||
source_trust_level: "B"
|
||||
confidence_score: 0.86
|
||||
created_at: 2026-07-04
|
||||
updated_at: 2026-07-04
|
||||
review_reason: ""
|
||||
merge_history: []
|
||||
tags: ["cpp", "programming-language", "w3schools", "functions", "default-parameters"]
|
||||
raw_sources: ["https://www.w3schools.com/cpp/cpp_function_default.asp"]
|
||||
applied_in: []
|
||||
github_commit: ""
|
||||
---
|
||||
|
||||
# [[CPP Default Parameters]]
|
||||
|
||||
## 🎯 한 줄 통찰 (One-line insight)
|
||||
This is a feature C never had — a function parameter can carry a FALLBACK VALUE (`string country = "Norway"`) that's automatically used ONLY when the caller omits that argument entirely, meaning `myFunction()` and `myFunction("USA")` are BOTH valid calls to the SAME function with different effective parameter counts, something C's rigid argument-count matching never permitted. [S1]
|
||||
|
||||
## 🧠 핵심 개념 (Core concepts)
|
||||
- **Default parameter value (`param = value`)** — assigns a fallback value used when the caller omits that argument. [S1]
|
||||
- **"Optional parameter"** — the common name for a parameter with a default value. [S1]
|
||||
- **Callable with or without the argument** — the SAME function accepts calls with a different number of arguments, unlike C where argument count must always match parameter count exactly. [S1]
|
||||
|
||||
## 📖 세부 내용 (Details)
|
||||
- Default value used when the argument is omitted: `void myFunction(string country = "Norway") { cout << country << "\n"; } myFunction("Sweden"); // Sweden myFunction("India"); // India myFunction(); // Norway (default) myFunction("USA"); // USA`. [S1]
|
||||
|
||||
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
|
||||
- **C에는 없던 기본 매개변수 기능**: 인자를 생략하면 자동으로 기본값이 쓰이는 "선택적 매개변수(optional parameter)"는 C의 고정된 인자 개수 일치 규칙과 달리, 같은 함수를 다른 개수의 인자로 호출할 수 있게 해준다는 점이 확인됨. [S1]
|
||||
|
||||
## 🛠️ 적용 사례 (Applied in summary)
|
||||
현재 발견된 실제 적용 사례가 없습니다 — 국가 매개변수를 생략하면 "Norway"가 기본으로 쓰이는 예제가 선택적 매개변수의 실전 활용을 보여준다. [S1]
|
||||
|
||||
## 💻 코드 패턴 (Code patterns)
|
||||
A default parameter value used when the argument is omitted (C++):
|
||||
```cpp
|
||||
void myFunction(string country = "Norway") {
|
||||
cout << country << "\n";
|
||||
}
|
||||
int main() {
|
||||
myFunction("Sweden"); // Sweden
|
||||
myFunction(); // Norway (default used)
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
## ✅ 검증 상태 및 신뢰도
|
||||
- **상태:** draft
|
||||
- **검증 단계:** conceptual
|
||||
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
|
||||
- **신뢰 점수:** 0.86
|
||||
- **중복 검사 결과:** 신규 생성 (New discovery)
|
||||
|
||||
## 🔗 지식 그래프 (Knowledge Graph)
|
||||
- **상위/루트:** [[C++ Tutorial]]
|
||||
- **관련 개념:** [[CPP Function Param]], [[CPP Function Overloading]], [[C Functions Parameters]]
|
||||
- **참조 맥락:** 기본 매개변수 — 함수 오버로딩(Function Overloading) 챕터로 이어짐.
|
||||
|
||||
## 📚 출처 (Sources)
|
||||
- [S1] W3Schools — C++ Default Parameters — https://www.w3schools.com/cpp/cpp_function_default.asp
|
||||
|
||||
## 📝 변경 이력 (Change history)
|
||||
- 2026-07-04: Initial draft synthesized from the W3Schools "C++ Default Parameters" page (Astra wiki-curation, P-Reinforce v3.1 format).
|
||||
Reference in New Issue
Block a user