상속(Inheritance) - C++/C#/CS 기초
상속(Inheritance)
📌 개념 정리
💻 예제
1
2
3
4
5
6
7
8
9
class Animal {
public:
virtual void Speak() { cout << "Animal\n"; }
};
class Dog : public Animal { // public 상속
public:
void Speak() override { cout << "Woof!\n"; }
};
⚡ 주의점
🔗 관련 페이지
This post is licensed under CC BY 4.0 by the author.