teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

fix code

2019/12/25 08:47

投稿

yohhoy
yohhoy

スコア6191

answer CHANGED
@@ -1,6 +1,6 @@
1
1
  ちょっと(?)マニアックな例として、テンプレート派生クラス(`Derived<T>`)からテンプレート基底クラス(`Base <T>`)のメンバ関数(`f`)を呼び出したいとき、`this->f`のようにthisポインタを明示する必要があります。
2
2
 
3
- Demo: [https://wandbox.org/permlink/yDBCClc4cAnjjBqN](https://wandbox.org/permlink/yDBCClc4cAnjjBqN)
3
+ Demo: [https://wandbox.org/permlink/SB2IZKM0kpbyon9z](https://wandbox.org/permlink/SB2IZKM0kpbyon9z)
4
4
  ```C++
5
5
  template<typename T>
6
6
  struct Base {
@@ -18,6 +18,6 @@
18
18
 
19
19
  int main()
20
20
  {
21
- D{}.h();
21
+ Derived<int>{}.h();
22
22
  }
23
23
  ```