docs(10_Wiki): 위키 구조 정리 — 언어 튜토리얼 카테고리 폴더 제거 + 신규 자산 동기화

Topic_CSS/Topic_HTML/Topic_JavaScript/Topic_Prompt/Topic_Comfyui 등 기존 카테고리 폴더를 정리하고,
Topic_Graphic/Dev 등 신규 산출물과 Topics 내부 세션/메모리 기록을 동기화.
This commit is contained in:
Antigravity Agent
2026-07-05 00:10:59 +09:00
parent a397bc4720
commit 1cfd3bbb56
1495 changed files with 68534 additions and 27 deletions
@@ -0,0 +1,86 @@
---
id: csharp-abstract
title: "C# Abstraction"
category: "Programming_Language"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["abstract class method C#", "C# 추상화"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.85
created_at: 2026-07-04
updated_at: 2026-07-04
review_reason: ""
merge_history: []
tags: ["csharp", "programming-language", "w3schools", "oop", "abstraction"]
raw_sources: ["https://www.w3schools.com/cs/cs_abstract.php"]
applied_in: []
github_commit: ""
---
# [[CSharp Abstraction]]
## 🎯 한 줄 통찰 (One-line insight)
Where C++ makes a class abstract IMPLICITLY (simply by containing at least one pure virtual function written as `virtual void f() = 0;`, with no dedicated "this class is abstract" keyword), C# makes it EXPLICIT with a dedicated `abstract` keyword on both the class AND each bodyless method (`abstract class Animal { public abstract void animalSound(); }`) — the same underlying restriction (cannot instantiate, must be inherited to be used, subclass MUST supply the missing method body) is enforced, but C# spells out the intent in the declaration itself rather than deriving it as a side-effect of the method's syntax. [S1]
## 🧠 핵심 개념 (Core concepts)
- **Data abstraction** — hiding certain implementation details, showing only essential information to the user; achievable via abstract classes OR interfaces (interfaces deferred to the next chapter). [S1]
- **`abstract` on a class** — creates a RESTRICTED class that cannot be used to instantiate objects directly (`new Animal()` on an abstract class is a compile error: "Cannot create an instance of the abstract class or interface"). [S1]
- **`abstract` on a method** — declared with NO body (just a signature ending in `;`); only legal inside an abstract class; the body must be supplied by whichever derived class inherits it, using `override`. [S1]
- **Mixed abstract classes** — an abstract class can freely combine abstract methods (no body) alongside regular, fully-implemented methods. [S1]
- **Must be accessed via inheritance** — the ONLY way to use an abstract class's functionality is to inherit from it and instantiate the DERIVED class instead. [S1]
## 📖 세부 내용 (Details)
- Illegal direct instantiation: `abstract class Animal { public abstract void animalSound(); public void sleep() { Console.WriteLine("Zzz"); } } ... Animal myObj = new Animal(); // Error`. [S1]
- Full working example (Animal converted from the Polymorphism chapter into an abstract class): `abstract class Animal { public abstract void animalSound(); public void sleep() { Console.WriteLine("Zzz"); } } class Pig : Animal { public override void animalSound() { Console.WriteLine("The pig says: wee wee"); } } ... Pig myPig = new Pig(); myPig.animalSound(); myPig.sleep();` — the abstract method's body comes entirely from `Pig`, while `sleep()` (a regular method) is inherited unchanged. [S1]
- Purpose stated directly: achieving security by hiding certain details and showing only the important parts of an object. [S1]
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
- **abstract가 클래스에도 명시적 키워드로 붙음**: C++는 순수 가상 함수(`virtual void f() = 0;`) 하나만 있어도 클래스가 암묵적으로 추상 클래스가 되고 별도의 "추상 클래스" 키워드가 없었지만, C#은 클래스 자체에도 `abstract` 키워드를 명시적으로 붙여야 한다는 점이 확인됨 — 같은 제약(인스턴스화 불가, 상속 필수, 파생 클래스가 반드시 구현 제공)을 표현하는 방식이 암묵적(C++) vs 명시적(C#)으로 다름. [S1]
- **Polymorphism 챕터의 Animal 예제가 그대로 재사용됨**: 새로운 예제를 만들지 않고 직전 Polymorphism 챕터의 Animal/Pig 예제를 abstract로 변환해 재사용한다는 점이 확인됨 — 개념을 처음부터 다시 설명하지 않고 이미 익힌 코드를 확장하는 방식. [S1]
## 🛠️ 적용 사례 (Applied in summary)
추상 메서드 animalSound()와 일반 메서드 sleep()을 함께 가진 abstract class Animal을 Pig가 상속해 animalSound()의 몸체만 제공하고 sleep()은 그대로 물려받아 쓰는 예제가 원문에서 직접 실전 활용 사례로 제시됨. [S1]
## 💻 코드 패턴 (Code patterns)
Abstract class mixing an abstract method (no body) and a regular method (C#):
```csharp
abstract class Animal
{
public abstract void animalSound(); // no body -- must be overridden
public void sleep() // regular method -- inherited as-is
{
Console.WriteLine("Zzz");
}
}
class Pig : Animal
{
public override void animalSound()
{
Console.WriteLine("The pig says: wee wee");
}
}
Pig myPig = new Pig();
myPig.animalSound(); // "The pig says: wee wee"
myPig.sleep(); // "Zzz"
```
## ✅ 검증 상태 및 신뢰도
- **상태:** draft
- **검증 단계:** conceptual
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
- **신뢰 점수:** 0.85
- **중복 검사 결과:** 신규 생성 (New discovery)
## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[C# Tutorial]]
- **관련 개념:** [[CSharp Polymorphism]], [[CSharp Interface]], [[CPP Templates]]
- **참조 맥락:** Polymorphism & Abstract 섹션의 마지막 챕터 — Interface 섹션으로 이어짐.
## 📚 출처 (Sources)
- [S1] W3Schools — C# Abstraction — https://www.w3schools.com/cs/cs_abstract.php
## 📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "C# Abstraction" page (Astra wiki-curation, P-Reinforce v3.1 format).