CPP practice question 28 of 30

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() { Aa("Hello"); string s(" world!"); a.add(s); cout

Full set: 228 questions
Answer options
A: program will display: Hello world!
B: compilation error Correct answer
C: program will display: world!Hello
D: program will run without any output
Correct Answer:
B. compilation error
Scroll to Top