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 |
In which memory a class gets stored(in heap /in stack)? And why??
What is a wchar_t in c++?
Describe Trees using C++ with an example.
Which operator can not be overloaded in C++?
What is an Iterator class?
Explain bubble sorting.
Explain "passing by value", "passing by pointer" and "passing by reference" ?
Describe public access specifiers?
What is a forward referencing and when should it be used?
Is oops and c++ same?
What is a built-in function?
total amount of milk produced each morning and then calculates and outputs the number of cartons needed for this milk , the cost of producing the milk and the profit from producing this milk.