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 an html tag?
Explain about templates of C++.
Can the operator == be overloaded for comparing two arrays consisting of characters by using string comparison?
Are vectors faster than arrays?
When do you call copy constructors?
What is a base class?
State the difference between delete and delete[].
Refer to a name of class or function that is defined within a namespace?
What is difference between malloc()/free() and new/delete?
Show the declaration for a static member variable.
Describe the advantages of operator overloading?
What is constructor c++?
What is c++ good for?
Why can’t you call invariants() as the first line of your constructor?
Is it possible to use a new for the reallocation of pointers ?