@dheeraj: const member function can be called by non-constant obj.....just
remove the non-constant member function...try urself.

On Tue, Jul 12, 2011 at 10:59 PM, dheeraj tyagi <dheeraj2...@gmail.com>wrote:

> const methods can only be called by constant objects. since in this case
> the object is not constant it will call the normal method.
>
>
> On Tue, Jul 12, 2011 at 10:24 PM, Aniket Dutta <aniketdutt...@gmail.com>wrote:
>
>> @dheeraj: but the prototypes are same..... how u are calling it
>> overloading plz explain
>>
>> On 7/12/11, dheeraj tyagi <dheeraj2...@gmail.com> wrote:
>> > const means that it cannot be overloaded..i think due to that this is
>> > happening.
>> >
>> > On Tue, Jul 12, 2011 at 9:26 PM, segfault <pawan1991ya...@gmail.com>
>> wrote:
>> >
>> >> #include<iostream>
>> >> using namespace std;
>> >> class x{
>> >> public:
>> >> x() {}
>> >>
>> >> int  func() const{
>> >> cout<<"it is const function\n";
>> >> }
>> >>
>> >> int func() {
>> >> cout<<"it is simple functin\n";
>> >> }
>> >>
>> >>
>> >> };
>> >> int main()
>> >> {
>> >> x a;
>> >> a.func();
>> >> return 0;
>> >> }
>> >>
>> >> why cann't it take const function?
>> >> explain it
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> Groups
>> >> "Algorithm Geeks" group.
>> >> To post to this group, send email to algogeeks@googlegroups.com.
>> >> To unsubscribe from this group, send email to
>> >> algogeeks+unsubscr...@googlegroups.com.
>> >> For more options, visit this group at
>> >> http://groups.google.com/group/algogeeks?hl=en.
>> >>
>> >>
>> >
>> >
>> > --
>> > With regards
>> > Dheeraj Tyagi
>> > 8197218001
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "Algorithm Geeks" group.
>> > To post to this group, send email to algogeeks@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > algogeeks+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/algogeeks?hl=en.
>> >
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> With regards
> Dheeraj Tyagi
> 8197218001
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to