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
what are the 10 different models of writing an addition program in C language?
What is binary tree in c?
Is there any data type in c with variable size?
write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.
What is the return type of sizeof?
how could explain about job profile
What are pointers? What are different types of pointers?
The purpose of this exercise is to benchmark file writing and reading speed. This exercise is divided into two parts. a). Write a file character by character such that the total file size becomes approximately >10K. After writing close the file handler, open a new stream and read the file character by character. Record both times. Execute this exercise at least 4 times b). Create a buffer capable of storing 100 characters. Now after generating the characters, first store them in the buffer. Once the buffer is filled up, store all the elements in the file. Repeat the process until the total file size becomes approximately >10K.While reading read a while line, store it in buffer and once buffer gets filled up, display the whole buffer. Repeat the exercise at least 4 times with different size of buffer (50, 100, 150 …). Records the times. c). Do an analysis of the differences in times and submit it in class.
What's the difference between constant char *p and char * constant p?
Can you write a programmer for FACTORIAL using recursion?
What is a pointer and how it is initialized?
What is a global variable in c?
What are compound statements?
What are the types of operators in c?
Do you know the use of 'auto' keyword?