Optiamlly resolve user defined class used in header file

Discussion in 'C++' started by Ami, Aug 4, 2011.

  1. Ami

    Ami Guest

    Hi All,
    I have a header file(my_derived.h) in which I derive a class from another user defined class which exists in another header file (my_base.h). Is it possible to avoid including my_base.h in my_derived.h and still can resolve the reference?
    My intention is to keep my_derived.h free of any include<> s.
    When I include my_base.h in my_derived.cpp, I get
    error C2504: 'my_base_class' : base class undefined

    I am using Visual studio 2010 as IDE.
    Any better suggestion to keep header files clean are highly appreciated.
    Thanks in advance.
    Ami, Aug 4, 2011
    #1
    1. Advertising

  2. Ami

    Ian Collins Guest

    On 08/ 4/11 07:45 PM, Ami wrote:
    > Hi All,
    > I have a header file(my_derived.h) in which I derive a class from another user defined class which exists in another header file (my_base.h). Is it possible to avoid including my_base.h in my_derived.h and still can resolve the reference?


    No.

    > My intention is to keep my_derived.h free of any include<> s.


    Why?

    --
    Ian Collins
    Ian Collins, Aug 4, 2011
    #2
    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. Angus Comber
    Replies:
    1
    Views:
    748
    Martin Ambuhl
    Jan 8, 2005
  2. Oodini
    Replies:
    1
    Views:
    1,766
    Keith Thompson
    Sep 27, 2005
  3. Replies:
    1
    Views:
    10,143
  4. steve yee
    Replies:
    5
    Views:
    344
    Bo Persson
    Jul 1, 2008
  5. mlt
    Replies:
    2
    Views:
    831
    Jean-Marc Bourguet
    Jan 31, 2009
Loading...

Share This Page