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

Why is polymorphism useful?

568


How do you print a string on the printer?

582


What is polymorphism and its type in c++?

594


What is data types c++?

546


What is the object serialization?

629






How to declare an array of pointers to integer?

585


Why do we use classes in programming?

578


What is late binding c++?

543


What is class in c++ with example?

570


Should I learn c or c++ first?

568


What is c++ & why it is used?

592


What kind of jobs can I get with c++?

599


Why do we use the using declaration?

664


What is decltype c++?

559


Can we define a constructor as virtual in c++?

605