| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
Tags
- Convert Sorted List to Binary Search Tree
- Python Implementation
- 파이썬
- 운영체제
- shiba
- 프로그래머스
- 109. Convert Sorted List to Binary Search Tree
- Regular Expression
- kaggle
- LeetCode
- Decorator
- Python
- 315. Count of Smaller Numbers After Self
- Substring with Concatenation of All Words
- Class
- 컴퓨터의 구조
- 밴픽
- 715. Range Module
- DWG
- Generator
- Python Code
- data science
- t1
- Protocol
- 30. Substring with Concatenation of All Words
- 시바견
- attribute
- iterator
- concurrency
- 43. Multiply Strings
Archives
- Today
- Total
Scribbling
[C++] Abstract Class, Interface, Multiple Inheritance 본문
Computer Science/C++
[C++] Abstract Class, Interface, Multiple Inheritance
focalpoint 2024. 2. 14. 07:18using namespace std;
class Shape {
public:
virtual void roar() = 0;
virtual ~Shape() {};
};
class I_Shape {
public:
friend ostream &operator<<(ostream &, const I_Shape &obj);
virtual void print(ostream &os) const = 0;
virtual ~I_Shape() {};
};
ostream &operator<<(ostream &os, const I_Shape &obj) {
obj.print(os);
return os;
}
class Circle : public Shape, public I_Shape {
public:
virtual void roar() override {
cout << "Circle" << endl;
}
virtual void print(ostream &os) const override {
os << "This is Circle" << endl;
}
virtual ~Circle() {};
};
int main() {
Circle cir = Circle();
Shape& obj = cir;
obj.roar();
I_Shape &i = cir;
cout << i;
}'Computer Science > C++' 카테고리의 다른 글
| [C++] Regular Expression Matching (0) | 2024.09.26 |
|---|---|
| [C++] Priority Queue with custom data type (0) | 2024.02.22 |
| [C++] lower_bound (0) | 2024.02.06 |
| [C++] Deque<int> (0) | 2024.02.06 |
| [C++] 전문가를 위한 C++ - Chapter 8 (0) | 2023.10.07 |