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
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
What is an array? What the different types of arrays in c?
What is the sizeof () operator?
When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.
Write a program to reverse a string.
Give basis knowledge of web designing ...
Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].
What is indirection? How many levels of pointers can you have?
how to find binary of number?
List a few unconditional control statement in c.
what is the different bitween abap and abap-hr?
What are the 5 elements of structure?
How do you define structure?
What are the advantages of using linked list for tree construction?
if (i = 0)printf ("True"); elseprintf("False"); Under what conditions will the above print out the string "True" a) Never b) Always c) When the value of i is 0 d) all of the above