700+ câu trắc nghiệm Ngôn ngữ lập trình C có đáp án - Phần 19

In the following code, which of the following variables can be accessed in “Friend”? class Base { public: int a; protected: int b; private: int c; }; class Derived : Base { int d; friend Fri

22/25

In the following code, which of the following variables can be accessed in “Friend”? class Base { public: int a; protected: int b; private: int c; }; class Derived : Base { int d; friend Friend; }; class Friend { Derived derived; };

only a and b

a,b and c

only a

error

Giải thích

Chọn đáp án D