class X
{
public:
int x;
static void f(int z);
};
void X::f(int y) {x=y;}
What is the error in the sample code above?
a) The class X does not have any protected members.
b) The static member function f() accesses the non-static z.
c) The static member function f() accesses the non-static x.
d) The member function f() must return a value.
e) The class X does not have any private members.
Answers were Sorted based on User's Feedback
Answer / d289
The error is in x not being referenced/initialized properly.
Is This Answer Correct ? | 1 Yes | 4 No |
Can we declare destructor as static? Explain?
How to allocate memory dynamically for a reference?
Why is swift so fast?
What is #include math h in c++?
What is the difference between a definition and a declaration?
if i want cin 12345678910 and cout abcdefghij. so how can i create the program?. example : if i key in 8910 so the answer is ghij.
Do vectors start at 0?
What are advantages of c++?
Is it possible to write a c++ template to check for a function's existence?
What do you mean by const correctness?
What does the ios::ate argument do?
Why is c++ not purely object oriented?