class foo {
public:
static int func(const char*& p) const;
};
This is illegal, why?
Answer Posted / abdur rab
A member function can be declard as Const by considering
the fact that they contain a hidden "this pointer" to be a
pointer to a const object. However Static methods do not
have the "this pointer", and hence can't be const or
virtual.
Hence it is illegal to declare a static function as const.
The C++ language standard stipulates at section 9.4.1
that "[...] A static
member function shall not be declared const
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Write a code to determine the total number of stops an elevator would take to serve N number of people.
How can I read/write structures from/to data files?
what type of questions arrive in interview over c programming?
Is there any data type in c with variable size?
What is the process to create increment and decrement stamen in c?
How many types of functions are there in c?
Do pointers need to be initialized?
What are the parts of c program?
Differentiate between functions getch() and getche().
Is using exit() the same as using return?
What is an arrays?
Explain about the functions strcat() and strcmp()?
Why is sizeof () an operator and not a function?
When should volatile modifier be used?
What is a structure in c language. how to initialise a structure in c?