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
There is a practice in coding to keep some code blocks in comment symbols than delete it when debugging. How this affect when debugging?
what is stack , heap ,code segment,and data segment
#include
Not all reserved words are written in lowercase. TRUE or FALSE?
what is a constant pointer in C
What is the use of bit field?
What is c mainly used for?
Explain how do you search data in a data file using random access method?
What is the stack in c?
Differentiate between calloc and malloc.
"C" language developed by "Dennis Ritchie" at AT & T. his remarks are a) too general, too abstract b) could deal with only specific problems c) lost generality of BCPL and B restored d) no remarks
How to draw the flowchart for structure programs?
What does the c preprocessor do?
What language is lisp written in?
What are global variables and how do you declare them?