최상위 10_Wiki/Topic_*였던 4개 카테고리 폴더를 10_Wiki/Topics/Topic_* 로 재배치.
콘텐츠 변경 없음(순수 폴더 이동) — Topics/ 하위 나머지 폴더는 이미 지난 커밋에서
전부 정리된 상태(잔존 항목은 에이전트 운영 상태 및 사용자가 보존을 요청한
업데이트0615/무제 3.canvas 뿐).
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#):
abstractclassAnimal{publicabstractvoidanimalSound();// no body -- must be overriddenpublicvoidsleep()// regular method -- inherited as-is{Console.WriteLine("Zzz");}}classPig:Animal{publicoverridevoidanimalSound(){Console.WriteLine("The pig says: wee wee");}}PigmyPig=newPig();myPig.animalSound();// "The pig says: wee wee"myPig.sleep();// "Zzz"
✅ 검증 상태 및 신뢰도
상태: draft
검증 단계: conceptual
출처 신뢰도: B (W3Schools — widely used educational reference, not a primary standards body)