class foo {
public:
static int func(const char*& p) const;
};
This is illegal, why?
Answer Posted / rafal dzbek
the 2nd const used in the example is invalid because it can
be used only with member functions which have a hidden
argument called this. The 2nd const would be applied to
this.
The funct is static member function so it hasn't any this
pointer.
Actually it is not obvious what is exactly inccorect.
We can remove static keyword, then we get syntactically
correct class definition, or we can remove 2nd const and
again the class can be considered valid.
Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
what is the difference between north western polytechnique university and your applied colleges?? please give ur answers for this. :)
FILE PROGRAMMING
What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers
what do u mean by Direct access files? then can u explain about Direct Access Files?
Why clrscr is used in c?
What is malloc calloc and realloc in c?
write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);
Define and explain about ! Operator?
What is the advantage of a random access file?
What is dynamic variable in c?
What are the loops in c?
Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
Explain what are multibyte characters?
Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions?
Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]