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
What is abstract keyword in c++?
Which programming language should I learn first?
Explain virtual class and friend class.
What is c++ runtime?
Write bites in Turbo c++ Header ("Include") Files.
What is a block in c++?
Can a class be static in c++?
What language does google use?
What are friend functions in C++?
How should runtime errors be handled in c++?
Explain linear search.
Can we overload operator in c++?
What is ostream in c++?
What is endl?
What is runtime errors c++?