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 is a rvalue?
What is the difference between procedural and functional programming?
What are the __date__ and __time__ preprocessor commands?
What are the loops in c?
I need previous papers of CSC.......plz help out by posting them.......
What is string length in c?
What are the different types of endless loops?
Is c# a good language?
What is c definition?
Can we change the value of #define in c?
Explain is it valid to address one element beyond the end of an array?
Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;
Write a C program that will accept a hexadecimal number as input and then display a menu that will permit any of the following operations to be carried out: Display the hexadecimal equivalent of the one's complement. (b) Carry out a masking operation and then display the hexadecimal equivalent of the result. (c) Carry out a bit shifting operation and then display the hexadecimal equivalent of the result. (d) Exit. If the masking operation is selected, prompt the user lor the type of operation (bitwise and, bitwise exclusive or, or bitwise or) and then a (hexadecimal) value for the mask. If the bit shifting operation is selected. prompt the user for the type of shift (left or right), and then the number of bits. Test the program with several different (hexadecimal) input values of your own choice.
Why c is called a middle level language?
What tq means in chat?