What will be the output of the following C++ code?
#include<iostream>
#include<any>
#include<string>
using namespace std;
int main()
{
string s = "Hello World";
any var(s);
cout<<any_cast<string>(var)<<endl;
return 0;
}
#include<iostream>
#include<any>
#include<string>
using namespace std;
int main()
{
string s = "Hello World";
any var(s);
cout<<any_cast<string>(var)<<endl;
return 0;
}A. Run-time error
B. Compile-time error
C. Hello World
D. Nothing is printed
Answer: Option D

Join The Discussion