題組內容

一、請回答下列有關 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:}