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
What are keywords in c with examples?
What does typeof return in c?
Can we use any name in place of argv and argc as command line arguments?
What is a list in c?
Why do we write return 0 in c?
Explain how do you declare an array that will hold more than 64kb of data?
can any one provide me the notes of data structure for ignou cs-62 paper
Why we write conio h in c?
I came across some code that puts a (void) cast before each call to printf. Why?
For what purpose null pointer used?
How main function is called in c?
I heard that you have to include stdio.h before calling printf. Why?
What is clrscr in c?
How can I do peek and poke in c?
What is a nested loop?