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<char*>(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<char*>(var)<<endl;
return 0;
}A. Hello World
B. Compile-time error
C. Run-time error
D. Nothing is printed
Answer: Option C

Join The Discussion