討論串[問題] 想請教一個C++考題
共 5 篇文章
內容預覽:
James大想問個問題. 之前知道constructor不該呼叫virtual但其實寫的時候根本沒留意過.... 現在想想. 假如我有個class A和class B:public A. 兩者都有個init() 各自有定義. 我猜我會這樣寫. A::A(). {. Init(). }. B::B()
(還有193個字)
內容預覽:
剛剛查了一下規格書. 裡面有這段. Member functions, including virtual functions (10.3), can be called during. construction or destruction (12.6.2).When a virtual func
(還有1383個字)
內容預覽:
說到 constructor 不要呼叫 virtual function 的問題. 最近才遇到一個 Java 與 C++ 行為很不一樣的範例. (難怪 Effective C++ 的作者有特別提到與 Java 的差異...可惜剛看書時候還不懂). http://nopaste.csie.org/08
(還有386個字)
內容預覽:
C++的規格書有段話這樣寫. the static type shall be a base class of the dynamic type of the object. to be deleted and the static type shall have a virtual destruc
(還有111個字)
內容預覽:
想請教各位版大...以下是一個C++面試題目,要考執行結果印出的是什麼. 程式碼如下:. #include <iostream>. #include <cstdio>. using namespace std;. class A. {. public:. A() { p(); }. ~A(){ p(
(還有283個字)