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 does 7/9*9 equal ? a) 1 b) 0.08642 c) 0
What is tellg () in c++?
Can c++ be faster than c?
How is data hiding achieved in c++?
Can member data be public?
What is guard code in c++?
What are c++ tokens?
What are the four main data types?
What is the most useful programming language?
write a corrected statement so that the instruction will work properly. if (4 < x < 11) y = 2 * x;
How do I use arrays in c++?
Write a program to add three numbers in C++ utilizing classes.
Why is c++ considered difficult?
Why do we use double in c++?
What does the nocreate and noreplace flag ensure when they are used for opening a file?