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

Write a code to determine the total number of stops an elevator would take to serve N number of people.

1257


How can I read/write structures from/to data files?

974


what type of questions arrive in interview over c programming?

2029


Is there any data type in c with variable size?

1099


What is the process to create increment and decrement stamen in c?

1059


How many types of functions are there in c?

1140


Do pointers need to be initialized?

1080


What are the parts of c program?

1101


Differentiate between functions getch() and getche().

1048


Is using exit() the same as using return?

1348


What is an arrays?

1072


Explain about the functions strcat() and strcmp()?

1048


Why is sizeof () an operator and not a function?

1030


When should volatile modifier be used?

1010


What is a structure in c language. how to initialise a structure in c?

1065