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.
Answer Posted / d289
The error is in x not being referenced/initialized properly.
| Is This Answer Correct ? | 1 Yes | 4 No |
Post New Answer View All Answers
When are exception objects created?
Tell me difference between constant pointer and pointer to a constant.
What is the auto keyword good for in c++?
Describe linked list using C++ with an example.
What are exceptions c++?
What is a pointer how and when is it used?
What's the best free c++ profiler for windows?
What relational operators if statements in c++?
List the issue that the auto_ptr object handles?
What is while loops?
Explain what are accessor methods?
Can there be at least some solution to determine the number of arguments passed to a variable argument list function?
what are the iterator and generic algorithms.
State the difference between delete and delete[].
How new/delete differs from malloc()/free?