Answer Posted / som shekhar
If the function is declared constant then you are not
intended to change the member variables of the class and if
you did the compiler throws an error.
In this case you can change the variable inside the const
function if the variable is declared as VOLATILE.
Similarly if you declare a variable as const then you cannot
change the value of the variable through its life time.
Now if you declared the constructor then you cannot
initialize the object.
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
What is a unnitialised pointer?
What is the correct syntax for inheritance a) class aclass : public superclass b) class aclass inherit superclass c) class aclass <-superclass
How will you call C functions from C ++ and vice-versa?
Why do we need runtime polymorphism in c++?
How can you prevent accessing of the private parts of my class by other programmers (violating encapsulation)?
What does count ++ do in c++?
Can we distribute function templates and class templates in object libraries?
Explain the difference between c & c++?
What size is allocated to the union variable?
What is a rooted hierarchy?
What is the this pointer?
What is the auto keyword good for in c++?
Is dev c++ a good compiler?
What is the use of function pointer?
Difference between pointer to constant vs. Pointer constant