[問題] 為什麼有些 class 無法直接宣告
在 BCB 裡面,使用者無法直接宣告:
TButton button;
// ERROR E2459 VCL style classes must
// be constructed using operator new
只能宣告成:
TButton *button;
button = new TButton(this);// 賦予 Owner
Q1.為什麼有些 class 無法直接宣告?
這種 class 是不是有特殊名稱?好處?
Q2.設定 Owner 後,是不是就不需要 delete
來和 new 配對?
當我 this->Close() 時自然就會消滅 button 了嗎?
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 39.13.91.15
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1446027921.A.18E.html
推
10/28 20:02, , 1F
10/28 20:02, 1F
→
10/28 23:33, , 2F
10/28 23:33, 2F
→
10/28 23:34, , 3F
10/28 23:34, 3F
→
10/28 23:51, , 4F
10/28 23:51, 4F
推
10/29 10:20, , 5F
10/29 10:20, 5F
→
10/29 10:21, , 6F
10/29 10:21, 6F
→
10/29 12:58, , 7F
10/29 12:58, 7F
推
10/30 09:00, , 8F
10/30 09:00, 8F
→
10/30 09:01, , 9F
10/30 09:01, 9F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章