C++ Institute C++ Certified Professional Programmer CPP Question # 28 Topic 3 Discussion

C++ Institute C++ Certified Professional Programmer CPP Question # 28 Topic 3 Discussion

CPP Exam Topic 3 Question 28 Discussion:
Question #: 28
Topic #: 3

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

#include

using namespace std;

template

class A {

T_v;

public:

A() {}

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

friend ostream & operator<<(ostream & c, const A & v);

};

template

ostream & operator<<(ostream & c, const A & v) {

c<

int main()

{

Aa(10);

cout<<a<

return 0;

}


A.

program will display:10


B.

program will not compile


C.

program will compile


D.

program will run without output


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.