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 |
What is the difference between public, private, protected inheritance?
What are the types of container classes?
Const char *p , char const *p What is the difference between the above two?
Why pure virtual functions are used if they don't have implementation / When does a pure virtual function become useful?
What is & in c++ function?
Do we have private destructors?
Explain shallow copy?
What is c++ programming language?
Write syntax to define friend functions in C++.
Can we define a constructor as virtual in c++?
Which one is a preferred language C or C++? Why?
What is linked list in c++?