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

In the following program, how many times Base’s constructor will be called? #include using namespace std; class Base { int static i; public: Base() { cout << "Base's constructor"; }; }; class

20/25

In the following program, how many times Base’s constructor will be called? #include using namespace std; class Base { int static i; public: Base() { cout << "Base's constructor"; }; }; class Sub1 : public virtual Base {}; class Sub2 : public Base {}; class Multi : public Sub1, public Sub2 {}; void main() { Multi m; system("pause"); }

1

2

3

error

Giải thích

Chọn đáp án B