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 %d used for?
How do I send escape sequences to control a terminal or other device?
What is #line?
Hai what is the different types of versions and their differences
What is the size of enum in bytes?
What is class and object in c?
where are auto variables stored? What are the characteristics of an auto variable?
What is this pointer in c plus plus?
Calculate 1*2*3*____*n using recursive function??
to find the closest pair
A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.
What is #include conio h?
What is wild pointer in c?
What are the two forms of #include directive?
Why pointers are used?