Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is %d used for?

1042


How do I send escape sequences to control a terminal or other device?

1079


What is #line?

1059


Hai what is the different types of versions and their differences

1944


What is the size of enum in bytes?

1090


What is class and object in c?

1124


where are auto variables stored? What are the characteristics of an auto variable?

1076


What is this pointer in c plus plus?

1093


Calculate 1*2*3*____*n using recursive function??

2042


to find the closest pair

2326


A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.

1722


What is #include conio h?

1002


What is wild pointer in c?

1078


What are the two forms of #include directive?

1170


Why pointers are used?

1079