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 object-oriented programming and procedural programming?
What is auto used for in c++?
If dog is a friend of boy, and terrier derives from dog, is terrier a friend of boy?
What is a try block?
Explain operator overloading.
What will happen if a pointer is deleted twice?
What is a constructor initializer list and when we use constructor initializer list?
What is a c++ object?
What is the Maximum Size that an Array can hold?
55 Answers Adobe, FutureSoft, HCL, Infosys, Satyam, TCS, Wipro,
What is type of 'this' pointer?
what are the characteristics of Class Members in C++?
How a new element can be added or pushed in a stack?