Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 백준
- guide
- c++
- Class
- UE5
- Unreal Engine 5
- 프로그래밍
- 기초
- w3school
- Tutorial
- String
- DP
- python
- C#
- 재귀
- Material
- 시작해요 언리얼 2022
- 오류
- Unity
- dynamic
- dfs
- parameter
- github
- loop
- W3Schools
- Programming
- Basic
- Algorithm
- 문제풀이
- 파이썬
Archives
- Today
- Total
행복한 개구리
C++ Classes - Inheritance / Multiple Inheritance 본문
다중 상속
또한 클래스는 하나 이상의 클래스를 쉼표로 구분한 목록으로 상속받을 수 있습니다.
예시
#include <iostream>
using namespace std;
// 기반 클래스
class MyClass {
public:
void myFunction() {
cout << "Some content in parent class.";
}
};
// 또 다른 기반 클래스
class MyOtherClass {
public:
void myOtherFunction() {
cout << "Some content in another parent class";
}
};
// 파생 클래스
class MyChild : public MyClass, public MyOtherClass {
};
int main() {
MyChild myObj;
myObj.myFunction();
myObj.myOtherFunction();
return 0;
}
'C++ > 공부내용' 카테고리의 다른 글
C++ Classes - Polymorphism (0) | 2022.06.30 |
---|---|
C++ Classes - Inheritance / Access Specifiers (0) | 2022.06.29 |
C++ Classes - Inheritance / Multilevel Inheritance (0) | 2022.06.29 |
C++ Classes - Inheritance / Inheritance (0) | 2022.06.29 |
C++ Classes - Encapsulation (0) | 2022.06.29 |