why can't derived class pointer can't point to base class object

Discussion in 'C++' started by ypjofficial@indiatimes.com, Dec 24, 2004.

  1. Guest

    Dear All,
    According to OOPs , a base class pointer can to point to derived class
    object....call this as fact1
    But somehow I am not comfortable while understanding this concept.
    The explanaition to the fact1 is given as since the derived object
    always consists of the base part , the base class pointer will always
    point to the base part in the derived object unless otherwise the
    function in the base class are declared as virtual and are overrided in
    the derived class.
    My confusion is, since the derived class always consists of the base
    class part in it,it should be more logical to think that the pointer to
    the derived class can store the address of the base class object as it
    will be always carrying the base class related services and data with
    it.
    This confusion gives me lot of headech while studying the COM and other
    advanced concept . will someone please give me any good explaination or
    justification of where my thinking process is going wrong(straying??)?.
    I will be very grateful to him..

    regds,
    Yogesh Joshi
     
    , Dec 24, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    1,325
    Jonathan Mcdougall
    Dec 24, 2004
  2. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,009
    Smokey Grindel
    Dec 2, 2006
  3. Replies:
    1
    Views:
    397
    myork
    May 23, 2007
  4. Replies:
    1
    Views:
    389
    Victor Bazarov
    May 23, 2007
  5. DanielJohnson
    Replies:
    7
    Views:
    2,012
    James Kanze
    Jan 17, 2009
Loading...

Share This Page