[問題] Call child class function from parent
開發平台(Platform): (Ex: Win10, Linux, ...)
Linux
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
g++
https://gist.github.com/anonymous/f67031c9f2c237589ca2cf4214c86e1a
error: cannot call member function ‘void Derived<T>::toImplement(T&) [with T
= double]’ without object Derived<T>::toImplement(t);
Base<T>::tryUsingImplemented(t); // 這邊從子類別函數 call 父類型函數ok
Derived<T>::toImplement(t); //但是從父類別函數 call 子類型函數不行
請問一下這是什麼原因?
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 112.104.30.124
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1506131006.A.505.html
→
09/23 10:03, , 1F
09/23 10:03, 1F
→
09/23 10:03, , 2F
09/23 10:03, 2F
推
09/23 19:19, , 3F
09/23 19:19, 3F
→
09/23 19:19, , 4F
09/23 19:19, 4F
→
09/23 19:19, , 5F
09/23 19:19, 5F
→
09/23 19:20, , 6F
09/23 19:20, 6F
→
09/27 22:39, , 7F
09/27 22:39, 7F
→
09/27 22:40, , 8F
09/27 22:40, 8F
→
09/27 22:40, , 9F
09/27 22:40, 9F