got it...

On Thu, Jul 28, 2011 at 6:31 PM, dilip makwana <dilipmakwa...@gmail.com>wrote:

> Use pointer to member , instead of regular pointers ...
>
> On 28 July 2011 17:49, mohit verma <mohit89m...@gmail.com> wrote:
>
>> hey  guys,
>> One simple example:
>>
>> class A{
>> int a,b;
>> public:
>>      A():a(2),b(3){}
>> };
>>
>> class B:public A
>> {
>>    public:
>>       int c;
>> };
>>
>> int main()
>> {
>>    B ob;
>> int *ptr=&ob.c;
>> cout<<*ptr;
>> ptr--;
>> cout<<*ptr;
>> ptr--;
>> cout<<*ptr;
>> return 0;
>> }
>>
>> AFAIK, inheritance in any visibility mode does not provide access to
>> private members of base class(Or even copy them to derived class memory
>> space in private section). So how can the above program can run
>> successfully? Could someone elaborate on inheritance internals : what is
>> going on in this case?
>> --
>> ........................
>> *MOHIT VERMA*
>>
>>  --
>> 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.
>>
>
>
>
> --
> *Dilip Makwana*
> VJTI
> BTech Computers Engineering
> 2009-2013
>
> --
> 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.
>



-- 
........................
*MOHIT VERMA*

-- 
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