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

This is illegal, why?

Answer Posted / jaroosh

This code is obviously wrong, and here is why :
declaring a method to be const, means :
this method cannot CHANGE values of any member variables,
but while the method already is static, it has no means of
changing values of member variables, because simply - it
cannot see them (its belongs to a CLASS, not any specific
OBJECT).

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

design and implement a data structure and performs the following operation with the help of file (included 1000 student marks in 5 sub. and %also) 1.how many students are fail in all 5 subjects (if >35) 2. delete all student data those are fail in all 5 subjects. 3. update the grace marks (5 no. if exam paper is 100 marks) 4. arrange the student data in ascending order basis of marks. 5.insert double of deleted students with marks in the list.

1491


Why clrscr is used after variable declaration?

1033


What are keywords c?

596


difference between object file and executable file

6090


What is scope rule in c?

601






Tell me the use of bit field in c language?

624


How can you tell whether a program was compiled using c versus c++?

614


Do you know the use of fflush() function?

592


difference between native and cross compilers

1668


Disadvantages of C language.

649


I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.

1488


List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.

2299


What is an auto keyword in c?

636


Is it possible to execute code even after the program exits the main() function?

805


How can I call fortran?

638