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 / rafal dzbek

the 2nd const used in the example is invalid because it can
be used only with member functions which have a hidden
argument called this. The 2nd const would be applied to
this.
The funct is static member function so it hasn't any this
pointer.

Actually it is not obvious what is exactly inccorect.
We can remove static keyword, then we get syntactically
correct class definition, or we can remove 2nd const and
again the class can be considered valid.

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 calloc malloc realloc in c?

1106


Explain two-dimensional array.

1129


Write a c program to demonstrate character and string constants?

2246


What is the difference between call by value and call by reference in c?

1212


How many types of errors are there in c language? Explain

1022


Is main is a keyword in c?

1174


write a program to rearrange the array such way that all even elements should come first and next come odd

2353


What's the right way to use errno?

1201


What is the difference between #include and #include 'file' ?

1117


What is the maximum no. of arguments that can be given in a command line in C.?

1199


Tell me what is the purpose of 'register' keyword in c language?

1039


Explain the difference between structs and unions in c?

1066


How are variables declared in c?

1149


How can you increase the allowable number of simultaneously open files?

1210


How is null defined in c?

1205