What will be printed out as a result of the following code execution?
#include <iostream>

class A;
template <typename T> void f(const A &a, T v);

class A
{
    friend void f<double>(const A &a, double v);    
};

template <> void f<int>(const A &a, int v)
{ std::cout << "1\n"; }

template <typename T> void f(const A &a, T v)
{ std::cout << "2\n"; }

int main()
{        
    A a;
    f(a, 3);
    return 0;
}

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes