| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- 컴퓨터의 구조
- data science
- 파이썬
- Python Implementation
- Class
- 715. Range Module
- 30. Substring with Concatenation of All Words
- Convert Sorted List to Binary Search Tree
- 315. Count of Smaller Numbers After Self
- shiba
- Regular Expression
- Decorator
- 109. Convert Sorted List to Binary Search Tree
- Protocol
- Substring with Concatenation of All Words
- DWG
- Python Code
- 시바견
- kaggle
- Generator
- iterator
- 43. Multiply Strings
- concurrency
- 프로그래머스
- t1
- 운영체제
- Python
- LeetCode
- attribute
- 밴픽
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 |