JavaScript is required

In protected inheritance:

A.

The public members of the base class become public

B.

The public members of the base class become protected

C.

The protected members of the base class become private

D.

The public members of the base class become inaccessible

Trả lời:

Đáp án đúng: B


Trong kế thừa protected, các thành viên public của lớp cơ sở (base class) trở thành protected trong lớp dẫn xuất (derived class). Các thành viên protected của lớp cơ sở vẫn là protected trong lớp dẫn xuất. Các thành viên private của lớp cơ sở không thể truy cập trực tiếp từ lớp dẫn xuất. Vì vậy, đáp án đúng là B.

Câu hỏi liên quan