Last Updated on May 22, 2022 by Admin 2
What happen if you try to compile and run the this program?
#include <iostream> using namespace std; template<class T> void f(T & a) //LINE I { cout << 1 +a << endl; } voidf(double & a) { cout <<2 + a<< endl; } int main() { double a = 1.5; f<double &> (a); //LINE II return 0; }
- the program outputs
127, 7f, 0x7f
- compilation error in LINE II
- compilation error in LINE I
- runtime error at LINE II
- the program outputs
2
- the program outputs
2.5
- the program outputs
3.5