How const functions will be treated by compiler?

Answers were Sorted based on User's Feedback

How const functions will be treated by compiler?..

Answer / achal ubbott

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

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

How const functions will be treated by compiler?..

Answer / window

Question is "How const functions will be treated by
compiler?" you guys answered the question "What do you now
about const functions?"

Please do not write what you know. Because of answers like
this, questions in websites are becoming obsolete.

Is This Answer Correct ?    1 Yes 0 No

How const functions will be treated by compiler?..

Answer / anil

it not allow to change value of the const variable.

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More C++ General Interview Questions

how many rounds and wt type of questios ask in the written test for first round 2. tech. round 3. and futher rounds

0 Answers   Thought Works,

How can you force instantiation of a template?

1 Answers   ABC,

Implement strcmp

3 Answers   Citadel, Bloomberg,

what is the size of a class which contains no member variables but has two objects??? is it 1 or 2??

4 Answers  

What are function poinetrs? where are they used?

1 Answers   CTS,

Explain "passing by value", "passing by pointer" and "passing by reference" ?

5 Answers  

What is a pure virtual function? Why is it represented as = is the internal implementation for the same

3 Answers   CTS,

this is to swap to strings....but in output the whole strings are swapped leaving first as it is...why it is so #include<iostream.h> int main() { char a[]="ajeet"; char b[]="singh"; long x=*a; long y=*b; cout<<x<<":"<<y; x=x+y; y=x-y; x=x-y; *a=x; *b=y; cout<<x<<":"<<y; cout<<&a<<endl; cout<<&b<<endl; }

1 Answers  

Implement strncpy

3 Answers  

Can we have "Virtual Constructors"?

10 Answers   TCS,

Difference between Top down and bottom up approaches for a given project ?

14 Answers   Siemens, Infosys, HCL, CSC, HP, IIT, BSNL,

Given a simple program designed to take inputs of integers from 1-1000 and to output the factorial value of that number, how would you test this program? You do not have access to the code. Please be as specific as possible.

4 Answers   Microsoft,