Câu hỏi:

28/07/2025 52 Lưu

What is the output of the following code? #include using namespace std; class professor { public: professor() { cout << "professor "; }; }; class researcher { public: researcher() { cout << "researcher "; }; }; class teacher : public professor { public: teacher() { cout << "teacher "; }; }; class myprofessor : public teacher, public virtual researcher { public: myprofessor() { cout << "myprofessor "; }; }; int main() { myprofessor obj; system("pause"); return 0; }

A. professor researcher teacher myprofessor

B. researcher professor teacher myprofessor

C. myprofessor teacher researcher professor

D. myprofessor researcher professor teacher

Quảng cáo

Trả lời:

verified Giải bởi Vietjack

Chọn đáp án B

CÂU HỎI HOT CÙNG CHỦ ĐỀ

Lời giải

Chọn đáp án B

Lời giải

Bạn cần đăng ký gói VIP ( giá chỉ từ 199K ) để làm bài, xem đáp án và lời giải chi tiết không giới hạn.

Nâng cấp VIP

Lời giải

Bạn cần đăng ký gói VIP ( giá chỉ từ 199K ) để làm bài, xem đáp án và lời giải chi tiết không giới hạn.

Nâng cấp VIP

Câu 6

A. There is nothing wrong

B. One cannot have a ‘Base’ pointer to ‘Derived’ since it is not derived publicly

C. One need a derived class pointer to point to a derived class

D. One required to code a constructor for Derived

Lời giải

Bạn cần đăng ký gói VIP ( giá chỉ từ 199K ) để làm bài, xem đáp án và lời giải chi tiết không giới hạn.

Nâng cấp VIP