看板 EE_DSnP 關於我們 聯絡資訊
似乎還有這樣子的用法... #include <iostream> #include <vector> #include "header.h" using namespace std; class test{ public: operator int(){ return 4; } }; int main(){ test b; cout << (int) b << endl; cout << "hello world!\n"; return 0; } --- 結果如下 --- 4 hello world! --- -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.4.187 ※ 編輯: herbert570 來自: 140.112.4.187 (12/29 18:51)
hfslyc:以此類推....? 12/30 00:34