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 |
Is ca high or low level language?
an integer constant must have atleast one a) character b) digit c) decimal point
without if else statement can be written ah
Write a program to find the Factorial of a number
What are literals in C++?
Is main a class in c++?
Difference between const char* p and char const* p?
Define upcasting.
What are c++ manipulators?
What is the difference between while and do while loop?
List the advantages of inheritance.
What is a static element?