C++ Institute C++ Certified Professional Programmer CPP Question # 41 Topic 5 Discussion

C++ Institute C++ Certified Professional Programmer CPP Question # 41 Topic 5 Discussion

CPP Exam Topic 5 Question 41 Discussion:
Question #: 41
Topic #: 5

What will happen when you attempt to compile and run the following code?

#include

using namespace std;

template

class A {

T_v;

public:

A(T v): _v(v){}

T getV() { return _v; }

};

int main()

{

A a(1);

cout << a.getV() <

return 0;

}


A.

program will display:1


B.

program will not compile


C.

program will compile


D.

program will cause runtime exception


Get Premium CPP Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.