How const functions will be treated by compiler?

Answer Posted / achal ubbott

A member function can be const qualified. e.g.

class SAAMPLE
{
int m1;
void f() const;

}
Now function f will not be able to modify the value of data
members. If so done the compiler would report an error.

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is pointer in c++ with example?

518


What is c++ redistributable?

619


What does the nocreate and noreplace flag ensure when they are used for opening a file?

676


an operation between an integer and real always yeilds a) integer result b) real result c) float result

708


How do you clear a buffer in c++?

535






Explain how functions are classified in C++ ?

804


What is the difference between prefix and postfix versions of operator++()?

591


What is the disadvantage of using a macro?

589


What is array in c++ example?

648


How many keywords are used in c++?

554


Define basic type of variable used for a different condition in C++?

662


What is the purpose of the "delete" operator?

624


Comment on local and global scope of a variable.

579


What do you mean by inheritance in c++?

601


Comment on assignment operator in c++.

708