阿摩線上測驗 登入

申論題資訊

試卷:104年 - 104 司法特種考試_三等_檢察事務官電子資訊組:程式語言#43037
科目:程式語言
年份:104年
排序:0

題組內容

一、請回答下列有關 C++程式的問題:(每小題 10 分,共 20 分)

申論題內容

⑵請解釋每一行輸出是由那個物件在那個時間點前後(請參考程式所標示的時間點 1, 2 ,3 ,4 ,5)印出的? #include "car.h" #include using namespace std ; Car::Car() { cout << "Car is constructed" << endl ;} Car::~Car() { cout << "Car is destroyed!" << endl ;} //---------------------------------------------------- Car honda ; 1:main() { 2: Car bmw ; 3: Car *camery = new Car() ; 4: honda.color = 1 ; 5: camery.color = 100 ; 6:}