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
What is getche() function?
what type of questions arrive in interview over c programming?
How do we open a binary file in Read/Write mode in C?
a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above
hi any body pls give me company name interview conduct "c" language only
All technical questions
What is c++ used for today?
Why array is used in c?
What is difference between && and & in c?
Is calloc better than malloc?
What is #include stdlib h?
What is pass by value in c?
When should you use a type cast?
Create a simple code fragment that will swap the values of two variables num1 and num2.
What is function and its example?