This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: A C++ question


Hi Aseem,

My concern is how could this code compile when in bar () function of 
class A, I am calling non const function on pointer b ?

The pointer b data member is const in that context.  Think "B* const b;".  Do not think "B const* b;".

It does not matter that the object pointed to by the const pointer is not const.

HTH,
--Eljay


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]