class foo {
public:
static int func(const char*& p) const;
};

This is illegal, why?

Answer Posted / john gummadi

There is nothing to do with class members here, we don't
see any. The function takes a constant pointer as a
parameter, when it is constant it cannot be changed
(although technically we can change by casting), then you
cannot use reference (&).

But who knows, compilers may accept, I haven't tested.

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I discover how many arguments a function was actually called with?

635


What does 3 mean in texting?

615


Why is it important to memset a variable, immediately after allocating memory to it ?

1555


Can we add pointers together?

620


Is flag a keyword in c?

682






What are different types of operators?

598


What is the difference between declaring a variable and defining a variable?

724


What is use of pointer?

587


largest Of three Number using without if condition?

1007


What is the difference between the = symbol and == symbol?

629


What is the difference between array and linked list in c?

600


What is sizeof int?

635


How pointers are declared?

560


What is the use of parallelize in spark?

576


What is function prototype in c language?

617