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 / guest

option 'c' is the answer

Is This Answer Correct ?    12 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many different levels of pointers are there?

664


What are literals in C++?

608


What is overloading unary operator?

623


What methods can be overridden in java?

684


Explain the static storage classes in c++.

715






What is the latest c++ version?

622


Why is it necessary to use a reference in the argument to the copy constructor?

641


What is a storage class? Mention the storage classes in c++.

606


Who created c++?

586


Can turbo c++ run c program?

646


Write a function to find the nth item from the end of a linked list in a single pass.

579


Describe the advantages of operator overloading?

586


Can I learn c++ without c?

615


What are iterators in c++?

606


What is vector processing?

678