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 |
How come you find out if a linked-list is a cycle or not?
If you want to share several functions or variables in several files maitaining the consistency how would you share it?
What is the difference between structure and class?
structure that describe a hotel with name, address,rooms and number of rooms
Definition of class?
Explain explicit container.
What are the restrictions apply to constructors and destructors?
What is stream and its types in c++?
What do you mean by function and operator overloading in c++?
Can I have a reference as a data member of a class? If yes, then how do I initialise it?
Explain the need for "Virtual Destructor"?
Why is c++ not purely object oriented?