khoahoc.vietjack.com

Câu hỏi:

28/07/2025 103 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ừ 250K ) để 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 5

A. The class must not have method

B. The class must have a constructor that takes no arguments

C. The class must have a function definition equal to zero

D. The class may only exist during the planning phase

Lời giải

Bạn cần đăng ký gói VIP ( giá chỉ từ 250K ) để 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. Have wine and cheese with that other friend

B. Allow that class to declare an instance of it in its list of private variables

C. Allow the other class (the one declared as friend) to access to the declaring class’s private variables

D. Allow the class declaring the other as a friend to access the declared class’s private variables

Lời giải

Bạn cần đăng ký gói VIP ( giá chỉ từ 250K ) để 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ừ 250K ) để 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