CertyRush
Đang tải...
C CertyRush
Câu hỏi free preview

Câu 62: CPP: C++ Certified Professional Programmer

What happens when you attempt to compile and run the following code?#include #include using namespace std;template class A {T_v;public:A() {}A(T v): _v(v){}T getV() { return _v; }void add(T & a) { _v+=a; }void add(string & a) {_v.insert(0, a);}};int main(){A a("Hello");string s(" world!");a.add(s);cout << a.getV() <<e…

Nội dung câu hỏi

What happens when you attempt to compile and run the following code?#include #include using namespace std;template class A {T_v;public:A() {}A(T v): _v(v){}T getV() { return _v; }void add(T & a) { _v+=a; }void add(string & a) {_v.insert(0, a);}};int main(){A a("Hello");string s(" world!");a.add(s);cout << a.getV() <<endl;return 0;}

Các lựa chọn

Đáp án được giữ gọn theo nhãn A, B, C, D trong phần bình chọn tương tác.

  1. A. program will display: Hello world!
  2. B. compilation error — đáp án hiện tại
  3. C. program will display: world!Hello
  4. D. program will run without any output

Cộng đồng

0 bình luận công khai. Tên thành viên được ẩn một phần.

Chưa có bình luận. Mở giao diện tương tác để bắt đầu thảo luận.

Câu hỏi liền kề