What will be the output of the following C++ code?
#include <iostream>
class Test
{
public:
void fun();
};
static void Test::fun()
{
std::cout<<"fun() is static";
}
int main()
{
Test::fun();
return 0;
}
#include <iostream>
class Test
{
public:
void fun();
};
static void Test::fun()
{
std::cout<<"fun() is static";
}
int main()
{
Test::fun();
return 0;
}
A. fun() is static
B. Compile-time Error
C. Run-time Error
D. Nothing is printed
Answer: Option B
Join The Discussion