Cpp クラス 継承 コンストラクタ 新しいページはコチラ
提供: yonewiki
(→クラス 継承 コンストラクタ) |
(→クラス 継承 コンストラクタ) |
||
70行: | 70行: | ||
</syntaxhighlight2> | </syntaxhighlight2> | ||
− | + | ||
+ | 基底クラスはいじる必要はなさそうです、派生クラスの変更が大事ですね。 | ||
<span style="color: #ffffff; background-color: #555555; padding: 0px 5px 0px 5px; display: inline-block;">cpp <span>(</span>派生クラス DeriveInheritance.h<span>)</span><!-- padding 上 右 下 左--> | <span style="color: #ffffff; background-color: #555555; padding: 0px 5px 0px 5px; display: inline-block;">cpp <span>(</span>派生クラス DeriveInheritance.h<span>)</span><!-- padding 上 右 下 左--> | ||
− | <syntaxhighlight2 lang="cpp" line start= | + | <syntaxhighlight2 lang="cpp" line start=200> |
#ifndef __DERIVEINHERITANCE_H_YONET__ | #ifndef __DERIVEINHERITANCE_H_YONET__ | ||
#define __DERIVEINHERITANCE_H_YONET__ | #define __DERIVEINHERITANCE_H_YONET__ | ||
99行: | 100行: | ||
<span style="color: #ffffff; background-color: #555555; padding: 0px 5px 0px 5px; display: inline-block;">cpp <span>(</span>DeriveInheritance.cpp<span>)</span><!-- padding 上 右 下 左--> | <span style="color: #ffffff; background-color: #555555; padding: 0px 5px 0px 5px; display: inline-block;">cpp <span>(</span>DeriveInheritance.cpp<span>)</span><!-- padding 上 右 下 左--> | ||
− | <syntaxhighlight2 lang="cpp" line start= | + | <syntaxhighlight2 lang="cpp" line start=300> |
#include "pch.h" | #include "pch.h" | ||
#include "DeriveInheritance.h" | #include "DeriveInheritance.h" | ||
128行: | 129行: | ||
} | } | ||
</syntaxhighlight2> | </syntaxhighlight2> | ||
+ | |||
+ | という具合の変更を加えました。この変更において重要なのは基底クラスの引数2個呼び出しをするということです。その役割に担っているのが、派生クラスのヘッダファイル部です。 | ||
[[C PlusPlus#C++からの技術|C++]]に戻る | [[C PlusPlus#C++からの技術|C++]]に戻る |