class foo {
public:
static int func(const char*& p) const;
};
This is illegal, why?
Answer Posted / jaroosh
This code is obviously wrong, and here is why :
declaring a method to be const, means :
this method cannot CHANGE values of any member variables,
but while the method already is static, it has no means of
changing values of member variables, because simply - it
cannot see them (its belongs to a CLASS, not any specific
OBJECT).
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Explain how can a program be made to print the line number where an error occurs?
What is const and volatile in c?
Explain about block scope in c?
What is else if ladder?
I have a varargs function which accepts a float parameter?
How can you find out how much memory is available?
typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none
Who invented b language?
Is null valid for pointers to functions?
Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
What does 3 mean in texting?
Where are c variables stored in memory?
What does node * mean?
the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset
I need testPalindrome and removeSpace
#include